summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/genlang21
1 files changed, 6 insertions, 15 deletions
diff --git a/tools/genlang b/tools/genlang
index 81d5066453..6a63f8004e 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -148,16 +148,6 @@ sub trim {
148 return $string; 148 return $string;
149} 149}
150 150
151sub match {
152 my ($string, $pattern)=@_;
153
154 return ($string =~ /^$pattern\z/);
155}
156
157sub blank {
158 # nothing to do
159}
160
161my %head; 151my %head;
162sub header { 152sub header {
163 my ($full, $n, $v)=@_; 153 my ($full, $n, $v)=@_;
@@ -181,13 +171,14 @@ sub parsetarget {
181 my $string; 171 my $string;
182 my @all= split(" *, *", $n); 172 my @all= split(" *, *", $n);
183 my $test; 173 my $test;
174 my $regexp;
184 for $test (@all) { 175 for $test (@all) {
185 $test =~ s/\*/.*/g; 176 $test =~ s/\*/.*/g;
186 $test =~ s/\?/./g; 177 $test =~ s/\?/./g;
187 178 $regexp = qr/^$test\z/;
188# print "TEST ($debug) $target for $test\n"; 179# print "TEST ($debug) $target for $test\n";
189 for my $part (@target_parts) { 180 for my $part (@target_parts) {
190 if($part =~ /^$test\z/) { 181 if($part =~ $regexp) {
191 $string = $v; 182 $string = $v;
192# print "MATCH: $test => $v\n"; 183# print "MATCH: $test => $v\n";
193 $$strref = $string; 184 $$strref = $string;
@@ -233,7 +224,7 @@ if($english) {
233 while(<ENG>) { 224 while(<ENG>) {
234 225
235 # get rid of DOS newlines 226 # get rid of DOS newlines
236 $_ =~ s/\r//g; 227 $_ =~ tr/\r//d;
237 228
238 if($_ =~ /^ *\<phrase\>/) { 229 if($_ =~ /^ *\<phrase\>/) {
239 # this is the start of a phrase 230 # this is the start of a phrase
@@ -350,7 +341,7 @@ sub compare {
350 $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n"; 341 $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n";
351 } 342 }
352 push @show, $l; 343 push @show, $l;
353 } 344 }
354 elsif($l =~ / *\<source\>/i) { 345 elsif($l =~ / *\<source\>/i) {
355 $mode=1; 346 $mode=1;
356 push @show, $l; 347 push @show, $l;
@@ -409,7 +400,7 @@ while(<LANG>) {
409 $line++; 400 $line++;
410 401
411 # get rid of DOS newlines 402 # get rid of DOS newlines
412 $_ =~ s/\r//g; 403 $_ =~ tr/\r//d;
413 404
414 if($_ =~ /^( *\#|[ \t\n\r]*\z)/) { 405 if($_ =~ /^( *\#|[ \t\n\r]*\z)/) {
415 # comment or empty line - output it if it's part of the header 406 # comment or empty line - output it if it's part of the header