summaryrefslogtreecommitdiff
path: root/tools/genlang
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-05-20 13:20:45 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-05-20 13:20:45 +0000
commitf22e6a59648debb9aaff7f9b05183a651b3787ce (patch)
tree510b41549ee6f4c5fbdff05a99bf9e421a26a947 /tools/genlang
parent0037a1b648cb06c4ba5fc23b2b9850bb7d9b8d35 (diff)
downloadrockbox-f22e6a59648debb9aaff7f9b05183a651b3787ce.tar.gz
rockbox-f22e6a59648debb9aaff7f9b05183a651b3787ce.zip
FS#6652 fix attempt. Make the phrase id counting take the dest pattern into
account so that the binary and source code output gets the same numbering. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13443 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/genlang')
-rwxr-xr-xtools/genlang56
1 files changed, 42 insertions, 14 deletions
diff --git a/tools/genlang b/tools/genlang
index 354f8217d2..e20ed637d1 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -182,6 +182,8 @@ if($english) {
182 open(ENG, "<$english") || die "can't open $english"; 182 open(ENG, "<$english") || die "can't open $english";
183 my @phrase; 183 my @phrase;
184 my $id; 184 my $id;
185 my $maybeid;
186 my $withindest;
185 while(<ENG>) { 187 while(<ENG>) {
186 188
187 # get rid of DOS newlines 189 # get rid of DOS newlines
@@ -191,28 +193,54 @@ if($english) {
191 # this is the start of a phrase 193 # this is the start of a phrase
192 } 194 }
193 elsif($_ =~ /^ *\<\/phrase\>/) { 195 elsif($_ =~ /^ *\<\/phrase\>/) {
194 # this is the end of a phrase, add it to the english hash 196
195 $english{$id}=join("", @phrase); 197 # if id is something, when we count and store this phrase
198 if($id) {
199 # voice-only entries get a difference range
200 if($id =~ /^VOICE_/) {
201 # Assign an ID number to this entry
202 $idmap{$id}=$vidnum;
203 $vidnum++;
204 }
205 else {
206 # Assign an ID number to this entry
207 $idmap{$id}=$idnum;
208 $idnum++;
209 print STDERR "DEST: bumped idnum to $idnum\n";
210 }
211
212 # this is the end of a phrase, add it to the english hash
213 $english{$id}=join("", @phrase);
214 }
196 undef @phrase; 215 undef @phrase;
216 $id="";
197 } 217 }
198 elsif($_ ne "\n") { 218 elsif($_ ne "\n") {
199 # gather everything related to this phrase 219 # gather everything related to this phrase
200 push @phrase, $_; 220 push @phrase, $_;
221 if($_ =~ /^ *\<dest\>/i) {
222 $withindest=1;
223 }
224 elsif($withindest && ($_ =~ /^ *\<\/dest\>/i)) {
225 $withindest=0;
226 }
227 elsif($withindest && ($_ =~ / *([^:]+): *(.*)/)) {
228 my ($name, $val)=($1, $2);
229 $dest=""; # in case it is left untouched for when the
230 # model name isn't "our"
231 dest($_, $name, $val);
232
233 print STDERR "DEST: \"$dest\" for $name / $id\n";
234
235 if($dest && ($dest ne "none")) {
236 $id = $maybeid;
237 print STDERR "DEST: use this id $id\n";
238 }
239 }
201 } 240 }
202 241
203 if($_ =~ /^ *id: ([^ \t\n]+)/i) { 242 if($_ =~ /^ *id: ([^ \t\n]+)/i) {
204 $id=$1; 243 $maybeid=$1;
205 # voice-only entries get a difference range
206 if($id =~ /^VOICE_/) {
207 # Assign an ID number to this entry
208 $idmap{$id}=$vidnum;
209 $vidnum++;
210 }
211 else {
212 # Assign an ID number to this entry
213 $idmap{$id}=$idnum;
214 $idnum++;
215 }
216 } 244 }
217 } 245 }
218 close(ENG); 246 close(ENG);