diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/updatelang | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/tools/updatelang b/tools/updatelang index b67a28400c..2691f53e39 100755 --- a/tools/updatelang +++ b/tools/updatelang | |||
@@ -124,6 +124,37 @@ sub combinetgts { | |||
124 | return %combined; | 124 | return %combined; |
125 | } | 125 | } |
126 | 126 | ||
127 | sub reduceformat($) { | ||
128 | my ($in) = @_; | ||
129 | my $out = ""; | ||
130 | my $infmt = 0; | ||
131 | |||
132 | for (my $i = 0; $i < length($in) ; $i++) { | ||
133 | my $c = substr($in, $i, 1); | ||
134 | if (!$infmt && ($c eq '%')) { | ||
135 | # First char in a format string! | ||
136 | $infmt = 1; | ||
137 | next; | ||
138 | } | ||
139 | next if (!$infmt); | ||
140 | |||
141 | if ($c ne '%') { | ||
142 | # Ignore literal %, otherwise dump specifier over | ||
143 | $out .= $c; | ||
144 | } | ||
145 | |||
146 | # Look for a terminating field: | ||
147 | my $count = $c =~ tr/sSdDuUxXzZ%//; | ||
148 | if ($count) { | ||
149 | $infmt = 0; | ||
150 | next; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | return $out; | ||
155 | } | ||
156 | |||
157 | |||
127 | ################## | 158 | ################## |
128 | 159 | ||
129 | if($#ARGV != 2) { | 160 | if($#ARGV != 2) { |
@@ -332,6 +363,17 @@ foreach my $id (@langorder) { | |||
332 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' is identical to english!\n"; | 363 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' is identical to english!\n"; |
333 | # print "#!! '$id:$tgt' dest identical ('$lp{$tgt}')\n"; | 364 | # print "#!! '$id:$tgt' dest identical ('$lp{$tgt}')\n"; |
334 | } | 365 | } |
366 | my $count1 = $ep{$tgt} =~ tr/%//; | ||
367 | my $count2 = $lp{$tgt} =~ tr/%//; | ||
368 | if ($count1 || $count2) { | ||
369 | my $fmt1 = reduceformat($ep{$tgt}); | ||
370 | my $fmt2 = reduceformat($lp{$tgt}); | ||
371 | if ($fmt1 ne $fmt2) { | ||
372 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has incorrect format specifiers! Copying from English!\n"; | ||
373 | $lang{$id}{'dest'}{$tgt} = $english{$id}{'dest'}{$tgt}; | ||
374 | # print "#!! '$id:$tgt' dest does not match src format args: '$fmt1' vs '$fmt2'\n"; | ||
375 | } | ||
376 | } | ||
335 | } | 377 | } |
336 | } | 378 | } |
337 | 379 | ||
@@ -365,7 +407,7 @@ foreach my $id (@langorder) { | |||
365 | $lang{$id}{'voice'}{$tgt} = $english{$id}{'voice'}{$tgt}; | 407 | $lang{$id}{'voice'}{$tgt} = $english{$id}{'voice'}{$tgt}; |
366 | } elsif ($lp{$tgt} ne $ep{$tgt}) { | 408 | } elsif ($lp{$tgt} ne $ep{$tgt}) { |
367 | if ($lp{$tgt} eq '' && $ep{$tgt} ne '') { | 409 | if ($lp{$tgt} eq '' && $ep{$tgt} ne '') { |
368 | # If the lang voice string is blank, complain, and copy from English | 410 | # If the lang voice string is blank, complain and copy from translation |
369 | # print "#!! '$id:$tgt' voice is blank ('$lp{$tgt}' vs '$ep{$tgt}')\n"; | 411 | # print "#!! '$id:$tgt' voice is blank ('$lp{$tgt}' vs '$ep{$tgt}')\n"; |
370 | if ($lang{$id}{'dest'}{$tgt} ne '' && | 412 | if ($lang{$id}{'dest'}{$tgt} ne '' && |
371 | $lang{$id}{'dest'}{$tgt} ne $english{$id}{'dest'}{$tgt}) { | 413 | $lang{$id}{'dest'}{$tgt} ne $english{$id}{'dest'}{$tgt}) { |