diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-05-30 21:00:45 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-05-30 21:02:18 -0400 |
commit | d22dbe74cb2c4c93a3c0b79a29c087bc39714c14 (patch) | |
tree | 42f8034ccf08eaab6d89971227a770aecf028851 /tools | |
parent | f0c1cf1eef99d3d57d655c7b5f9da076c949e910 (diff) | |
download | rockbox-d22dbe74cb2c4c93a3c0b79a29c087bc39714c14.tar.gz rockbox-d22dbe74cb2c4c93a3c0b79a29c087bc39714c14.zip |
updatelang: '~' is not a legal character in dest or voice strings
...Unless it's the very first character (and will get stripped).
So detect and complain about this!
Change-Id: I5e333e8ee134160f64a67783b0d5aa564716d44e
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/updatelang | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/updatelang b/tools/updatelang index e0305ba7d1..98c5d3cb73 100755 --- a/tools/updatelang +++ b/tools/updatelang | |||
@@ -365,7 +365,8 @@ foreach my $id (@langorder) { | |||
365 | } | 365 | } |
366 | if ($id eq 'LANG_VOICED_DATE_FORMAT') { | 366 | if ($id eq 'LANG_VOICED_DATE_FORMAT') { |
367 | my $sane = $lp{$tgt}; | 367 | my $sane = $lp{$tgt}; |
368 | $sane =~ tr/YAmd//d; | 368 | $sane =~ s/^~?(.*)/$1/; # Strip off leading ~ if it's there as it's not a legal character for the format. |
369 | $sane =~ tr/YAmd~//d; | ||
369 | if (length($sane) != 0) { | 370 | if (length($sane) != 0) { |
370 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has illegal characters! Restoring from English!\n"; | 371 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has illegal characters! Restoring from English!\n"; |
371 | $lang{$id}{'notes'} .= "### the previously used one is commented below:\n"; | 372 | $lang{$id}{'notes'} .= "### the previously used one is commented below:\n"; |
@@ -393,9 +394,11 @@ foreach my $id (@langorder) { | |||
393 | } | 394 | } |
394 | } | 395 | } |
395 | 396 | ||
396 | if ($lang{$id}{'dest'}{$tgt} =~ tr/"//) { | 397 | my $sane = $lang{$id}{'dest'}{$tgt}; |
398 | $sane =~ s/^~?(.*)/$1/; # Strip off leading ~ if it's there as it's not a legal character otherwise | ||
399 | if ($sane =~ tr/"~//) { | ||
397 | # If it has suspicious characters that are not allowed | 400 | # If it has suspicious characters that are not allowed |
398 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has some suspicious characters, please double-check!\n"; | 401 | $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has some suspicious characters (eg '~'), please double-check!\n"; |
399 | # print "#!! '$id:$tgt' suspicious characters\n"; | 402 | # print "#!! '$id:$tgt' suspicious characters\n"; |
400 | } | 403 | } |
401 | } | 404 | } |
@@ -462,9 +465,11 @@ foreach my $id (@langorder) { | |||
462 | $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is identical to english! (correct or prefix with ~)\n"; | 465 | $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is identical to english! (correct or prefix with ~)\n"; |
463 | } | 466 | } |
464 | } | 467 | } |
465 | if ($lang{$id}{'voice'}{$tgt} =~ tr/%"//) { | 468 | my $sane = $lang{$id}{'voice'}{$tgt}; |
469 | $sane =~ s/^~?(.*)/$1/; # Strip off leading ~ if it's there as it's not a legal character otherwise | ||
470 | if ($sane =~ tr/%"~//) { | ||
466 | # If it has suspicious characters that are not normally voiced.. | 471 | # If it has suspicious characters that are not normally voiced.. |
467 | $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters (eg '%'), please double-check!\n"; | 472 | $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters (eg '%' or '~'), please double-check!\n"; |
468 | # print "#!! '$id:$tgt' suspicious characters\n"; | 473 | # print "#!! '$id:$tgt' suspicious characters\n"; |
469 | } | 474 | } |
470 | if ($lang{$id}{'voice'}{$tgt} =~ /\.\.\./) { | 475 | if ($lang{$id}{'voice'}{$tgt} =~ /\.\.\./) { |