summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-05-01 09:04:16 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-05-01 09:11:58 -0400
commitb32266b7dbf26cac1d71e17581367c63ff6b6b55 (patch)
treef48ee58e80b6b75b2a5fa6f045002f158cc3adaa
parent67f61e1e13a78fb9383a2eb66495d30c50434c17 (diff)
downloadrockbox-b32266b7dbf26cac1d71e17581367c63ff6b6b55.tar.gz
rockbox-b32266b7dbf26cac1d71e17581367c63ff6b6b55.zip
updatelang: Avoid some runtime warnings
...And add '"' to the suspicious character list Change-Id: Ia8a790882085a6e82c89cae09164ddbccf36e47f
-rwxr-xr-xtools/updatelang24
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/updatelang b/tools/updatelang
index 7b51831aea..6f0012c573 100755
--- a/tools/updatelang
+++ b/tools/updatelang
@@ -47,7 +47,7 @@ sub parselangfile {
47 next; 47 next;
48 } elsif($line =~ /^ *#/) { 48 } elsif($line =~ /^ *#/) {
49 push(@comments, "$line\n") if ($pos eq 'lang'); 49 push(@comments, "$line\n") if ($pos eq 'lang');
50 # comments are ignored! 50 # comments are ignored, but retained!
51 next; 51 next;
52 } elsif ($pos eq 'phrase' && $line =~ /^([^:]+): ?(.*)$/) { 52 } elsif ($pos eq 'phrase' && $line =~ /^([^:]+): ?(.*)$/) {
53 $thisphrase{$pos}->{$1} = $2; 53 $thisphrase{$pos}->{$1} = $2;
@@ -374,10 +374,16 @@ foreach my $id (@langorder) {
374 } 374 }
375 } 375 }
376 my $count1 = $ep{$tgt} =~ tr/%//; 376 my $count1 = $ep{$tgt} =~ tr/%//;
377 my $count2 = $lp{$tgt} =~ tr/%//; 377 my $count2 = 0;
378 if (defined($lp{$tgt})) {
379 $count2 = $lp{$tgt} =~ tr/%//;
380 }
378 if ($count1 || $count2) { 381 if ($count1 || $count2) {
379 my $fmt1 = reduceformat($ep{$tgt}); 382 my $fmt1 = reduceformat($ep{$tgt});
380 my $fmt2 = reduceformat($lp{$tgt}); 383 my $fmt2 = "";
384 if ($count2) {
385 $fmt2 = reduceformat($lp{$tgt});
386 }
381 if ($fmt1 ne $fmt2) { 387 if ($fmt1 ne $fmt2) {
382 $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has incorrect format specifiers! Copying from English!\n"; 388 $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has incorrect format specifiers! Copying from English!\n";
383 $lang{$id}{'notes'} .= "### the previously used one is commented below:\n"; 389 $lang{$id}{'notes'} .= "### the previously used one is commented below:\n";
@@ -386,6 +392,14 @@ foreach my $id (@langorder) {
386# print "#!! '$id:$tgt' dest does not match src format args: '$fmt1' vs '$fmt2'\n"; 392# print "#!! '$id:$tgt' dest does not match src format args: '$fmt1' vs '$fmt2'\n";
387 } 393 }
388 } 394 }
395 if (defined($lp{$tgt})) {
396 $count2 = $lp{$tgt} =~ tr/"//;
397 if ($count2 > 0) {
398 # If it has suspicious characters that are not allowed
399 $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has some suspicious characters, please double-check!\n";
400# print "#!! '$id:$tgt' suspicious characters\n";
401 }
402 }
389 } 403 }
390} 404}
391 405
@@ -425,7 +439,7 @@ foreach my $id (@langorder) {
425 $lang{$id}{'dest'}{$tgt} ne $english{$id}{'dest'}{$tgt}) { 439 $lang{$id}{'dest'}{$tgt} ne $english{$id}{'dest'}{$tgt}) {
426 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is blank! Copying from translated <dest>!\n"; 440 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is blank! Copying from translated <dest>!\n";
427 $lang{$id}{'voice'}{$tgt} = $lang{$id}{'dest'}{$tgt}; 441 $lang{$id}{'voice'}{$tgt} = $lang{$id}{'dest'}{$tgt};
428 if ($lang{$id}{'voice'}{$tgt} =~ /%/) { 442 if ($lang{$id}{'voice'}{$tgt} =~ /%"/) {
429 # If it has suspicious characters that are not normally voiced.. 443 # If it has suspicious characters that are not normally voiced..
430 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n"; 444 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n";
431 #print "#!! '$id:$tgt' suspicious characters\n"; 445 #print "#!! '$id:$tgt' suspicious characters\n";
@@ -455,7 +469,7 @@ foreach my $id (@langorder) {
455 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is identical to english!\n"; 469 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is identical to english!\n";
456 } 470 }
457 } 471 }
458 if ($lp{$tgt} =~ /%/) { 472 if (defined($lp{$tgt}) && ($lp{$tgt} =~ /%"/)) {
459 # If it has suspicious characters that are not normally voiced.. 473 # If it has suspicious characters that are not normally voiced..
460 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n"; 474 $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n";
461# print "#!! '$id:$tgt' suspicious characters\n"; 475# print "#!! '$id:$tgt' suspicious characters\n";