forked from len0rd/rockbox
updatelang: Avoid some runtime warnings
...And add '"' to the suspicious character list Change-Id: Ia8a790882085a6e82c89cae09164ddbccf36e47f
This commit is contained in:
parent
67f61e1e13
commit
b32266b7db
1 changed files with 19 additions and 5 deletions
|
@ -47,7 +47,7 @@ sub parselangfile {
|
||||||
next;
|
next;
|
||||||
} elsif($line =~ /^ *#/) {
|
} elsif($line =~ /^ *#/) {
|
||||||
push(@comments, "$line\n") if ($pos eq 'lang');
|
push(@comments, "$line\n") if ($pos eq 'lang');
|
||||||
# comments are ignored!
|
# comments are ignored, but retained!
|
||||||
next;
|
next;
|
||||||
} elsif ($pos eq 'phrase' && $line =~ /^([^:]+): ?(.*)$/) {
|
} elsif ($pos eq 'phrase' && $line =~ /^([^:]+): ?(.*)$/) {
|
||||||
$thisphrase{$pos}->{$1} = $2;
|
$thisphrase{$pos}->{$1} = $2;
|
||||||
|
@ -374,10 +374,16 @@ foreach my $id (@langorder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $count1 = $ep{$tgt} =~ tr/%//;
|
my $count1 = $ep{$tgt} =~ tr/%//;
|
||||||
my $count2 = $lp{$tgt} =~ tr/%//;
|
my $count2 = 0;
|
||||||
|
if (defined($lp{$tgt})) {
|
||||||
|
$count2 = $lp{$tgt} =~ tr/%//;
|
||||||
|
}
|
||||||
if ($count1 || $count2) {
|
if ($count1 || $count2) {
|
||||||
my $fmt1 = reduceformat($ep{$tgt});
|
my $fmt1 = reduceformat($ep{$tgt});
|
||||||
my $fmt2 = reduceformat($lp{$tgt});
|
my $fmt2 = "";
|
||||||
|
if ($count2) {
|
||||||
|
$fmt2 = reduceformat($lp{$tgt});
|
||||||
|
}
|
||||||
if ($fmt1 ne $fmt2) {
|
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 <dest> section for '$id:$tgt' has incorrect format specifiers! Copying from English!\n";
|
||||||
$lang{$id}{'notes'} .= "### the previously used one is commented below:\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";
|
# 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}{'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}{'notes'} .= "### The <voice> section for '$id:$tgt' is blank! Copying from translated <dest>!\n";
|
||||||
$lang{$id}{'voice'}{$tgt} = $lang{$id}{'dest'}{$tgt};
|
$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..
|
# 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";
|
$lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n";
|
||||||
#print "#!! '$id:$tgt' suspicious characters\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";
|
$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..
|
# 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";
|
$lang{$id}{'notes'} .= "### The <voice> section for '$id:$tgt' has some suspicious characters, please double-check!\n";
|
||||||
# print "#!! '$id:$tgt' suspicious characters\n";
|
# print "#!! '$id:$tgt' suspicious characters\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue