diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2002-09-16 15:01:38 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2002-09-16 15:01:38 +0000 |
| commit | e19f763d791333193080bfd088c9b29ea7129a61 (patch) | |
| tree | aa5a680cf59a3b8348bd1b3a79c5a706f5b41175 /tools | |
| parent | 842d5a99d0885f15d5e28cf8661e6ba5529e4b15 (diff) | |
| download | rockbox-e19f763d791333193080bfd088c9b29ea7129a61.zip rockbox-e19f763d791333193080bfd088c9b29ea7129a61.tar.gz rockbox-e19f763d791333193080bfd088c9b29ea7129a61.tar.bz2 rockbox-e19f763d791333193080bfd088c9b29ea7129a61.tar.xz | |
generate a lang.h file from a .lang input
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2301 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/genlang | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tools/genlang b/tools/genlang new file mode 100755 index 0000000..827ceb3 --- /dev/null +++ b/tools/genlang @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +if(!$ARGV[0]) { + print <<MOO +Usage: lang.pl <file> +MOO +; + exit; +} + +print <<MOO +/* This file was automaticly generated using genlan */ +/* + * The str() macro/functions is how to access strings that might be + * translated. Use it like str(MACRO) and except a string to be + * returned! + */ +#define str(x) x +MOO + ; + +open(LANG, "<$ARGV[0]"); +while(<LANG>) { + if($_ =~ / *\#/) { + # comment + next; + } + if($_ =~ / *([a-z]+): *(.*)/) { + ($var, $value) = ($1, $2); + # print "$var => $value\n"; + + $set{$var} = $value; + + if($var eq "new") { + # the last one for a single phrase + + if(!$value) { + # if not set, get the english version + $value = $set{'eng'}; + } + + print "#define ".$set{'id'}." $value\n"; + undef %set; + } + + } + +} +close(LANG); |