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 | |
parent | f0c1cf1eef99d3d57d655c7b5f9da076c949e910 (diff) | |
download | rockbox-d22dbe74cb.tar.gz rockbox-d22dbe74cb.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
-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) { } if ($id eq 'LANG_VOICED_DATE_FORMAT') { my $sane = $lp{$tgt}; - $sane =~ tr/YAmd//d; + $sane =~ s/^~?(.*)/$1/; # Strip off leading ~ if it's there as it's not a legal character for the format. + $sane =~ tr/YAmd~//d; if (length($sane) != 0) { $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has illegal characters! Restoring from English!\n"; $lang{$id}{'notes'} .= "### the previously used one is commented below:\n"; @@ -393,9 +394,11 @@ foreach my $id (@langorder) { } } - if ($lang{$id}{'dest'}{$tgt} =~ tr/"//) { + my $sane = $lang{$id}{'dest'}{$tgt}; + $sane =~ s/^~?(.*)/$1/; # Strip off leading ~ if it's there as it's not a legal character otherwise + if ($sane =~ tr/"~//) { # 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"; + $lang{$id}{'notes'} .= "### The <dest> section for '$id:$tgt' has some suspicious characters (eg '~'), please double-check!\n"; # print "#!! '$id:$tgt' suspicious characters\n"; } } @@ -462,9 +465,11 @@ foreach my $id (@langorder) { $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' is identical to english! (correct or prefix with ~)\n"; } } - if ($lang{$id}{'voice'}{$tgt} =~ tr/%"//) { + my $sane = $lang{$id}{'voice'}{$tgt}; + $sane =~ s/^~?(.*)/$1/; # Strip off leading ~ if it's there as it's not a legal character otherwise + if ($sane =~ tr/%"~//) { # If it has suspicious characters that are not normally voiced.. - $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters (eg '%'), please double-check!\n"; + $lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters (eg '%' or '~'), please double-check!\n"; # print "#!! '$id:$tgt' suspicious characters\n"; } if ($lang{$id}{'voice'}{$tgt} =~ /\.\.\./) { |