summaryrefslogtreecommitdiff
path: root/tools
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
parent0037a1b648cb06c4ba5fc23b2b9850bb7d9b8d35 (diff)
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')
-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) {
open(ENG, "<$english") || die "can't open $english";
my @phrase;
my $id;
+ my $maybeid;
+ my $withindest;
while(<ENG>) {
# get rid of DOS newlines
@@ -191,28 +193,54 @@ if($english) {
# this is the start of a phrase
}
elsif($_ =~ /^ *\<\/phrase\>/) {
- # this is the end of a phrase, add it to the english hash
- $english{$id}=join("", @phrase);
+
+ # if id is something, when we count and store this phrase
+ if($id) {
+ # voice-only entries get a difference range
+ if($id =~ /^VOICE_/) {
+ # Assign an ID number to this entry
+ $idmap{$id}=$vidnum;
+ $vidnum++;
+ }
+ else {
+ # Assign an ID number to this entry
+ $idmap{$id}=$idnum;
+ $idnum++;
+ print STDERR "DEST: bumped idnum to $idnum\n";
+ }
+
+ # this is the end of a phrase, add it to the english hash
+ $english{$id}=join("", @phrase);
+ }
undef @phrase;
+ $id="";
}
elsif($_ ne "\n") {
# gather everything related to this phrase
push @phrase, $_;
+ if($_ =~ /^ *\<dest\>/i) {
+ $withindest=1;
+ }
+ elsif($withindest && ($_ =~ /^ *\<\/dest\>/i)) {
+ $withindest=0;
+ }
+ elsif($withindest && ($_ =~ / *([^:]+): *(.*)/)) {
+ my ($name, $val)=($1, $2);
+ $dest=""; # in case it is left untouched for when the
+ # model name isn't "our"
+ dest($_, $name, $val);
+
+ print STDERR "DEST: \"$dest\" for $name / $id\n";
+
+ if($dest && ($dest ne "none")) {
+ $id = $maybeid;
+ print STDERR "DEST: use this id $id\n";
+ }
+ }
}
if($_ =~ /^ *id: ([^ \t\n]+)/i) {
- $id=$1;
- # voice-only entries get a difference range
- if($id =~ /^VOICE_/) {
- # Assign an ID number to this entry
- $idmap{$id}=$vidnum;
- $vidnum++;
- }
- else {
- # Assign an ID number to this entry
- $idmap{$id}=$idnum;
- $idnum++;
- }
+ $maybeid=$1;
}
}
close(ENG);