From d22dbe74cb2c4c93a3c0b79a29c087bc39714c14 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 30 May 2024 21:00:45 -0400 Subject: 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 --- tools/updatelang | 15 ++++++++++----- 1 file 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 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 section for '$id:$tgt' has some suspicious characters, please double-check!\n"; + $lang{$id}{'notes'} .= "### The 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 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 section for '$id:$tgt' has some suspicious characters (eg '%'), please double-check!\n"; + $lang{$id}{'notes'} .= "### The 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} =~ /\.\.\./) { -- cgit v1.2.3