diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-05-01 09:04:16 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-05-01 09:11:58 -0400 |
commit | b32266b7dbf26cac1d71e17581367c63ff6b6b55 (patch) | |
tree | f48ee58e80b6b75b2a5fa6f045002f158cc3adaa | |
parent | 67f61e1e13a78fb9383a2eb66495d30c50434c17 (diff) | |
download | rockbox-b32266b7db.tar.gz rockbox-b32266b7db.zip |
updatelang: Avoid some runtime warnings
...And add '"' to the suspicious character list
Change-Id: Ia8a790882085a6e82c89cae09164ddbccf36e47f
-rwxr-xr-x | tools/updatelang | 24 |
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 { next; } elsif($line =~ /^ *#/) { push(@comments, "$line\n") if ($pos eq 'lang'); - # comments are ignored! + # comments are ignored, but retained! next; } elsif ($pos eq 'phrase' && $line =~ /^([^:]+): ?(.*)$/) { $thisphrase{$pos}->{$1} = $2; @@ -374,10 +374,16 @@ foreach my $id (@langorder) { } } my $count1 = $ep{$tgt} =~ tr/%//; - my $count2 = $lp{$tgt} =~ tr/%//; + my $count2 = 0; + if (defined($lp{$tgt})) { + $count2 = $lp{$tgt} =~ tr/%//; + } if ($count1 || $count2) { my $fmt1 = reduceformat($ep{$tgt}); - my $fmt2 = reduceformat($lp{$tgt}); + my $fmt2 = ""; + if ($count2) { + $fmt2 = reduceformat($lp{$tgt}); + } if ($fmt1 ne $fmt2) { $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has incorrect format specifiers! Copying from English!\n"; $lang{$id}{'notes'} .= "### the previously used one is commented below:\n"; @@ -386,6 +392,14 @@ foreach my $id (@langorder) { # print "#!! '$id:$tgt' dest does not match src format args: '$fmt1' vs '$fmt2'\n"; } } + if (defined($lp{$tgt})) { + $count2 = $lp{$tgt} =~ tr/"//; + if ($count2 > 0) { + # If it has suspicious characters that are not allowed + $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has some suspicious characters, please double-check!\n"; +# print "#!! '$id:$tgt' suspicious characters\n"; + } + } } } @@ -425,7 +439,7 @@ foreach my $id (@langorder) { $lang{$id}{'dest'}{$tgt} ne $english{$id}{'dest'}{$tgt}) { $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is blank! Copying from translated <dest>!\n"; $lang{$id}{'voice'}{$tgt} = $lang{$id}{'dest'}{$tgt}; - if ($lang{$id}{'voice'}{$tgt} =~ /%/) { + if ($lang{$id}{'voice'}{$tgt} =~ /%"/) { # If it has suspicious characters that are not normally voiced.. $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n"; #print "#!! '$id:$tgt' suspicious characters\n"; @@ -455,7 +469,7 @@ foreach my $id (@langorder) { $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is identical to english!\n"; } } - if ($lp{$tgt} =~ /%/) { + if (defined($lp{$tgt}) && ($lp{$tgt} =~ /%"/)) { # If it has suspicious characters that are not normally voiced.. $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n"; # print "#!! '$id:$tgt' suspicious characters\n"; |