From 53e8d526530de3e386a1168b3b8b4e72ebe5da53 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 29 Oct 2002 08:23:33 +0000 Subject: 1. If the translated file used ID strings not present in the english one, the first string was ruined (it was stored as a blank on number 0!) 2. This script now accepts -v to display verbose debug-friendly output. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2769 a1c6a512-1295-4272-9138-f99709370657 --- tools/binlang | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/binlang b/tools/binlang index 3d7fdff1db..158c755459 100755 --- a/tools/binlang +++ b/tools/binlang @@ -28,6 +28,11 @@ MOO exit; } +if($ARGV[0] eq "-v") { + shift @ARGV; + $debug=1; +} + my $english = $ARGV[0]; my $input = $ARGV[1]; my $output = $ARGV[2]; @@ -47,6 +52,7 @@ printf OFILE ("\x1a%c", $langversion); # magic lang file header # # We scan the english file to get the correct order of the id numbers # +my $idnum=0; # start with a true number while() { if($_ =~ / *\#/) { # comment @@ -92,11 +98,20 @@ while() { if($value =~ s/^\"(.*)\" *$/$1/g) { $idnum = $idnum{$set{'id'}}; - $idnum{$set{'id'}} = '_done_'; - printf OFILE ("%c%c%s\x00", - ($idnum>>8), ($idnum&0xff), - $value); + if($idnum eq "") { + warn "Found no ".$set{'id'}." in english file!\n"; + } + else { + $idnum{$set{'id'}} = '_done_'; + + printf OFILE ("%c%c%s\x00", + ($idnum>>8), ($idnum&0xff), + $value); + if($debug) { + printf("%02x => %s\n", $idnum, $value); + } + } } else { warn "String for ".$set{'id'}." misses quotes\n"; -- cgit v1.2.3