1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Solomon Peachy 2024-05-30 21:00:45 -04:00
parent f0c1cf1eef
commit d22dbe74cb

View file

@ -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} =~ /\.\.\./) {