summaryrefslogtreecommitdiff
path: root/tools/genlang
diff options
context:
space:
mode:
Diffstat (limited to 'tools/genlang')
-rwxr-xr-xtools/genlang18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/genlang b/tools/genlang
index 621ec37a58..aa7e090c35 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -11,7 +11,7 @@
11# 11#
12 12
13# binary version for the binary lang file 13# binary version for the binary lang file
14my $langversion = 3; # 3 was the latest one used in the v1 format 14my $langversion = 4; # 3 was the latest one used in the v1 format
15 15
16# A note for future users and readers: The original v1 language system allowed 16# A note for future users and readers: The original v1 language system allowed
17# the build to create and use a different language than english built-in. We 17# the build to create and use a different language than english built-in. We
@@ -28,8 +28,8 @@ Usage: genlang [options] <langv2 file>
28 Make the tool create a [prefix].c and [prefix].h file. 28 Make the tool create a [prefix].c and [prefix].h file.
29 29
30 -b=<outfile> 30 -b=<outfile>
31 Make the tool create a binary language (.lng) file namaed [outfile]. 31 Make the tool create a binary language (.lng) file named [outfile].
32 The use of this option requires that you also use -e. 32 The use of this option requires that you also use -e, -t and -i.
33 33
34 -u 34 -u
35 Update language file. Given the translated file and the most recent english 35 Update language file. Given the translated file and the most recent english
@@ -48,6 +48,9 @@ Usage: genlang [options] <langv2 file>
48 separated with colons. This will make genlang to use all the specified 48 separated with colons. This will make genlang to use all the specified
49 strings when searching for a matching phrase. 49 strings when searching for a matching phrase.
50 50
51 -i=<target id>
52 The target id number, needed for -b.
53
51 -o 54 -o
52 Voice mode output. Outputs all id: and voice: lines for the given target! 55 Voice mode output. Outputs all id: and voice: lines for the given target!
53 56
@@ -88,11 +91,18 @@ if(!$check) {
88 print "Please use at least one of -p, -u, -o and -b\n"; 91 print "Please use at least one of -p, -u, -o and -b\n";
89 exit; 92 exit;
90} 93}
94
91if(($binary || $update || $voiceout) && !$english) { 95if(($binary || $update || $voiceout) && !$english) {
92 print "Please use -e too when you use -b, -o or -u\n"; 96 print "Please use -e too when you use -b, -o or -u\n";
93 exit; 97 exit;
94} 98}
95 99
100my $target_id = $i;
101if($binary && !$target_id) {
102 print "Please specify a target id number (with -i)!\n";
103 exit;
104}
105
96my $target = $t; 106my $target = $t;
97if(!$target && !$update) { 107if(!$target && !$update) {
98 print "Please specify a target (with -t)!\n"; 108 print "Please specify a target (with -t)!\n";
@@ -586,7 +596,7 @@ elsif($binary) {
586 596
587 open(OUTF, ">$binary") or die "Can't create $binary"; 597 open(OUTF, ">$binary") or die "Can't create $binary";
588 binmode OUTF; 598 binmode OUTF;
589 printf OUTF ("\x1a%c", $langversion); # magic lang file header 599 printf OUTF ("\x1a%c%c", $langversion, $target_id); # magic lang file header
590 600
591 # loop over the target phrases 601 # loop over the target phrases
592 for $i (1 .. $idcount) { 602 for $i (1 .. $idcount) {