From 9a4a5e98345aa825fcaf1fc3529d0e672b2978de Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 21 Apr 2004 06:39:52 +0000 Subject: Now correctly generates language files, ignoring voice entries git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4532 a1c6a512-1295-4272-9138-f99709370657 --- tools/binlang | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/tools/binlang b/tools/binlang index 64e9a8576a..83824e38b3 100755 --- a/tools/binlang +++ b/tools/binlang @@ -64,10 +64,21 @@ while() { ($var, $value) = ($1, $2); $set{$var} = $value; + # "new" is always the last one, so now we have them all if($var eq "new") { - # the last one for a single phrase - $idnum{$set{'id'}}=$idnum; - $idnum++; + $value = $set{'eng'}; + + if($value =~ s/^\"(.*)\"\s*$/$1/g) { + # Skip voice-only entries + if(!$value && $set{'voice'}) { + $idnum{$set{'id'}} = '_done_'; + next; + } + + # Assign an ID number to this entry + $idnum{$set{'id'}}=$idnum; + $idnum++; + } undef %set; } } @@ -83,12 +94,15 @@ while() { $_ =~ s/\r//g; if($_ =~ /^ *([a-z]+): *(.*)/) { ($var, $value) = ($1, $2); - # print "$var => $value\n"; $set{$var} = $value; + # "new" is always the last one, so now we have them all if($var eq "new") { - # the last one for a single phrase + $idnum = $idnum{$set{'id'}}; + + # Skip already processed entries (like voice-only ones) + next if($idnum eq '_done_'); if(!$value) { # if not set, get the english version @@ -96,15 +110,6 @@ while() { } if($value =~ s/^\"(.*)\"\s*$/$1/g) { - - # Skip voice-only entries - if(!$value && $set{'voice'}) { - $idnum{$set{'id'}} = '_done_'; - next; - } - - $idnum = $idnum{$set{'id'}}; - if($idnum eq "") { warn "Found no ".$set{'id'}." in english file!\n"; } -- cgit v1.2.3