diff options
author | Tom Ross <midgey@rockbox.org> | 2009-03-03 01:38:26 +0000 |
---|---|---|
committer | Tom Ross <midgey@rockbox.org> | 2009-03-03 01:38:26 +0000 |
commit | 104fb378ece524ac2934471c14304a70d8ed0e2b (patch) | |
tree | c5e5cf47af84676c43dc7b323037ab80df3b116e /tools/genlang | |
parent | 9f6e117e8283ce683efe546b32139dd723c724d1 (diff) |
More GSoC related work. Have genlang parse the user field of the lang files. For now, all user strings are core. In the future more users will be added. Add missing user fields to a few phrases in some languages. Genlang will also warn if a phrase is missing the user field or it is unknown. The output format is unchanged.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20187 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/genlang')
-rwxr-xr-x | tools/genlang | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/genlang b/tools/genlang index 05183b8d67..45171290d6 100755 --- a/tools/genlang +++ b/tools/genlang @@ -20,6 +20,10 @@ my $langversion = 4; # 3 was the latest one used in the v1 format # figured it was boring and unnecessary to write support for now since we # don't use it anymore. +my %user2num = + ('core' => 1); + + if(!$ARGV[0]) { print <<MOO Usage: genlang [options] <langv2 file> @@ -207,6 +211,8 @@ if($english) { my @phrase; my $id; my $maybeid; + my $user; + my $maybeuser; my $withindest; my $numphrases = 0; while(<ENG>) { @@ -254,6 +260,7 @@ if($english) { # we unconditionally always use all IDs when the "update" # feature is used $id = $maybeid; + $user = $user2num{$maybeuser}; # print "DEST: use this id $id\n"; } else { @@ -278,6 +285,9 @@ if($english) { $maybeid=$1; $sortorder{$maybeid}=$numphrases++; } + if($_ =~ /^ *user: ([^ \t\n]+)/i) { + $maybeuser=$1; + } } close(ENG); } @@ -443,6 +453,12 @@ while(<LANG>) { if($dest eq '""' && $phrase{'desc'} !~ /deprecated/i && $idstr !~ /^VOICE/) { print STDERR "$input:$line:1: warning: empty dest before line in non-deprecated phrase!\n"; } + + my $user = $user2num{trim($phrase{'user'})}; + if(!$user) { + print STDERR "$input:$line:1: warning: unknown user!\n"; + $user = 1; + } # Use the ID name to figure out which id number range we # should use for this phrase. Voice-only strings are @@ -467,11 +483,13 @@ while(<LANG>) { print "source: $src\n"; print "dest: $dest\n"; print "voice: $voice\n"; + print "user: $user\n"; } undef $src; undef $dest; undef $voice; + undef $user; undef %phrase; } |