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