diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-05 11:43:38 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-05 11:43:38 +0000 |
commit | 6d80565b1b5277820593de80bf036304be93c8ef (patch) | |
tree | 230b2d57d96190430c757cd98534db290c95bd3e /tools | |
parent | f06c98fec82e8c800e09603f3022676dbbfdd84b (diff) | |
download | rockbox-6d80565b1b5277820593de80bf036304be93c8ef.tar.gz rockbox-6d80565b1b5277820593de80bf036304be93c8ef.zip |
RTL support in menus
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22945 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/genlang | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/genlang b/tools/genlang index d191a820a6..44dfcc6fdf 100755 --- a/tools/genlang +++ b/tools/genlang | |||
@@ -13,7 +13,8 @@ | |||
13 | # See apps/language.c (TODO: Use common include for both) | 13 | # See apps/language.c (TODO: Use common include for both) |
14 | # Cookie and binary version for the binary lang file | 14 | # Cookie and binary version for the binary lang file |
15 | my $LANGUAGE_COOKIE = 0x1a; | 15 | my $LANGUAGE_COOKIE = 0x1a; |
16 | my $LANGUAGE_VERSION = 0x04; | 16 | my $LANGUAGE_VERSION = 0x05; |
17 | my $LANGUAGE_FLAG_RTL = 0x01; | ||
17 | 18 | ||
18 | # A note for future users and readers: The original v1 language system allowed | 19 | # A note for future users and readers: The original v1 language system allowed |
19 | # the build to create and use a different language than english built-in. We | 20 | # the build to create and use a different language than english built-in. We |
@@ -167,6 +168,12 @@ sub phrase { | |||
167 | $phrase{$n}=$v; | 168 | $phrase{$n}=$v; |
168 | } | 169 | } |
169 | 170 | ||
171 | my %options; | ||
172 | sub options { | ||
173 | my ($full, $n, $v)=@_; | ||
174 | $options{$n}=$v; | ||
175 | } | ||
176 | |||
170 | sub parsetarget { | 177 | sub parsetarget { |
171 | my ($debug, $strref, $full, $n, $v)=@_; | 178 | my ($debug, $strref, $full, $n, $v)=@_; |
172 | my $string; | 179 | my $string; |
@@ -381,6 +388,8 @@ my $voiceid=0x8000; # counter for voice-only ID numbers | |||
381 | open(LANG, "<$input") || die "Error: couldn't read language file named $input\n"; | 388 | open(LANG, "<$input") || die "Error: couldn't read language file named $input\n"; |
382 | my @phrase; | 389 | my @phrase; |
383 | my $header = 1; | 390 | my $header = 1; |
391 | my $langoptions = 0; | ||
392 | |||
384 | while(<LANG>) { | 393 | while(<LANG>) { |
385 | 394 | ||
386 | $line++; | 395 | $line++; |
@@ -510,9 +519,15 @@ while(<LANG>) { | |||
510 | print "### $idstr: The phrase is not used. Skipped\n"; | 519 | print "### $idstr: The phrase is not used. Skipped\n"; |
511 | } | 520 | } |
512 | } | 521 | } |
513 | undef @phrase; | ||
514 | |||
515 | } # end of </phrase> | 522 | } # end of </phrase> |
523 | elsif($part eq "/options") { | ||
524 | # closing the options | ||
525 | if ($options{'rtl'}) { | ||
526 | $langoptions |= $LANGUAGE_FLAG_RTL; | ||
527 | } | ||
528 | } # end of </options> | ||
529 | |||
530 | undef @phrase; | ||
516 | 531 | ||
517 | # starts with a slash, this _ends_ this section | 532 | # starts with a slash, this _ends_ this section |
518 | $m = pop @m; # get back old value, the previous level's tag | 533 | $m = pop @m; # get back old value, the previous level's tag |
@@ -661,7 +676,8 @@ elsif($binary) { | |||
661 | 676 | ||
662 | open(OUTF, ">$binary") or die "Error: Can't create $binary"; | 677 | open(OUTF, ">$binary") or die "Error: Can't create $binary"; |
663 | binmode OUTF; | 678 | binmode OUTF; |
664 | printf OUTF ("%c%c%c", $LANGUAGE_COOKIE, $LANGUAGE_VERSION, $target_id); # magic lang file header | 679 | printf OUTF ("%c%c%c%c", $LANGUAGE_COOKIE, $LANGUAGE_VERSION, $target_id, |
680 | $langoptions); # magic lang file header | ||
665 | 681 | ||
666 | # loop over the target phrases | 682 | # loop over the target phrases |
667 | for $i (1 .. $idcount) { | 683 | for $i (1 .. $idcount) { |