diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-10-29 08:23:33 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-10-29 08:23:33 +0000 |
commit | 53e8d526530de3e386a1168b3b8b4e72ebe5da53 (patch) | |
tree | bfe845653a2c12e298b2761fbf93abd7ff4398a3 | |
parent | be8ae1c0e2bfb50fce5211b55cd0f13661002a5d (diff) | |
download | rockbox-53e8d526530de3e386a1168b3b8b4e72ebe5da53.tar.gz rockbox-53e8d526530de3e386a1168b3b8b4e72ebe5da53.zip |
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
-rwxr-xr-x | tools/binlang | 23 |
1 files 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 | |||
28 | exit; | 28 | exit; |
29 | } | 29 | } |
30 | 30 | ||
31 | if($ARGV[0] eq "-v") { | ||
32 | shift @ARGV; | ||
33 | $debug=1; | ||
34 | } | ||
35 | |||
31 | my $english = $ARGV[0]; | 36 | my $english = $ARGV[0]; |
32 | my $input = $ARGV[1]; | 37 | my $input = $ARGV[1]; |
33 | my $output = $ARGV[2]; | 38 | my $output = $ARGV[2]; |
@@ -47,6 +52,7 @@ printf OFILE ("\x1a%c", $langversion); # magic lang file header | |||
47 | # | 52 | # |
48 | # We scan the english file to get the correct order of the id numbers | 53 | # We scan the english file to get the correct order of the id numbers |
49 | # | 54 | # |
55 | my $idnum=0; # start with a true number | ||
50 | while(<ENG>) { | 56 | while(<ENG>) { |
51 | if($_ =~ / *\#/) { | 57 | if($_ =~ / *\#/) { |
52 | # comment | 58 | # comment |
@@ -92,11 +98,20 @@ while(<LANG>) { | |||
92 | if($value =~ s/^\"(.*)\" *$/$1/g) { | 98 | if($value =~ s/^\"(.*)\" *$/$1/g) { |
93 | 99 | ||
94 | $idnum = $idnum{$set{'id'}}; | 100 | $idnum = $idnum{$set{'id'}}; |
95 | $idnum{$set{'id'}} = '_done_'; | ||
96 | 101 | ||
97 | printf OFILE ("%c%c%s\x00", | 102 | if($idnum eq "") { |
98 | ($idnum>>8), ($idnum&0xff), | 103 | warn "Found no ".$set{'id'}." in english file!\n"; |
99 | $value); | 104 | } |
105 | else { | ||
106 | $idnum{$set{'id'}} = '_done_'; | ||
107 | |||
108 | printf OFILE ("%c%c%s\x00", | ||
109 | ($idnum>>8), ($idnum&0xff), | ||
110 | $value); | ||
111 | if($debug) { | ||
112 | printf("%02x => %s\n", $idnum, $value); | ||
113 | } | ||
114 | } | ||
100 | } | 115 | } |
101 | else { | 116 | else { |
102 | warn "String for ".$set{'id'}." misses quotes\n"; | 117 | warn "String for ".$set{'id'}." misses quotes\n"; |