forked from len0rd/rockbox
lang: Complain if there are multiple target matches for a given string
The tooling will always use the *final* match, which may or may not be what is desired. Treat this as a bug, and complain appropriately. However, there is a special case. The RTC set screen uses strings that include the device button names. There should be an entry for the specific device, but if not, we wanted to fall back to the string specified by the 'rtc' feature flag as opposed to falling back to the default, empty string. To still support this, add a special "FALLBACK" value; If we end up using this for a device, the tooling will treat this as a bug, and complain accordingly. This should fix FS#13615 and FS13616, and may introduce build failures on targets that are missing appropriate entries. We'll see. Change-Id: Ie78bb247f968e19d450a0fbf6e1177b6d01126a1
This commit is contained in:
parent
336d42c72b
commit
a88ef80560
3 changed files with 60 additions and 76 deletions
|
@ -17,16 +17,14 @@
|
||||||
# This is the master of the language files. This is the original, the one with
|
# This is the master of the language files. This is the original, the one with
|
||||||
# all the existing strings Rockbox features.
|
# all the existing strings Rockbox features.
|
||||||
#
|
#
|
||||||
# The target names used for target-specific strings are set in the ARCHOS
|
|
||||||
# variable in the root Makefile
|
|
||||||
#
|
|
||||||
# *WARNING*
|
# *WARNING*
|
||||||
#
|
#
|
||||||
# If you want to add a new string, add it to the end of this file!
|
# If you want to add a new string, add it to the end of this file!
|
||||||
# Removing strings will break the numbering of strings in binary lang files and
|
# Removing strings will break the numbering of strings in binary lang
|
||||||
# voice files so instead of removing a unused <phrase>, change the desc field
|
# files and voice files so instead of removing a unused <phrase>, change
|
||||||
# to "deprecated" (without quotes) and either blank the strings or change them to
|
# the desc field to "deprecated" (without quotes) and either blank the
|
||||||
# "deprecated" (without quotes) and do *not* change the targets.
|
# strings or change them to "deprecated" (without quotes) and do *not*
|
||||||
|
# change the targets.
|
||||||
#
|
#
|
||||||
# If you re-order things or remove entries, you must bump the binary language
|
# If you re-order things or remove entries, you must bump the binary language
|
||||||
# file version number in both the 'genlang' tool and the language loader code.
|
# file version number in both the 'genlang' tool and the language loader code.
|
||||||
|
@ -40,57 +38,31 @@
|
||||||
# when doing updates etc, while the <dest> ones are used when this file is
|
# when doing updates etc, while the <dest> ones are used when this file is
|
||||||
# used to simply get the full set of english strings for a particular target.
|
# used to simply get the full set of english strings for a particular target.
|
||||||
#
|
#
|
||||||
# All phrases have a default string like: *: "default" that will be used if no
|
# All phrases have a default string like:
|
||||||
# other string matches for the particular model you build the language for. If
|
# *: "default"
|
||||||
# you want a particular string for the iriver iriverh300 series you'd write it like:
|
# that will be used if no other string matches for the particular model you
|
||||||
# iriverh300: "iriverh300-specific string" (below the default line). If your string isn't
|
# build the anguage for. If you want a particular string for the iriver
|
||||||
# used for all targets set the default to none like: *: none (no quotes!) this
|
# iriverh300 series you'd write it like:
|
||||||
# will not include the string for target that will not need it, see
|
# iriverh300: "iriverh300-specific string" (below the default line).
|
||||||
# apps/features.txt for available categories that can be used instead of the
|
# If your string isn't used for all targets set the default to none like:
|
||||||
# target name, for example: swcodec: "swcodec-specific string".
|
# *: none (no quotes!)
|
||||||
|
# this will not include the string for target that will not need it, see
|
||||||
|
# apps/features.txt for available categories that can be used instead of
|
||||||
|
# the target name, for example: swcodec: "swcodec-specific string".
|
||||||
#
|
#
|
||||||
# The target names used are picked from the configure script and are set in the
|
# The target names are either the model name picked from the
|
||||||
# MODELNAME variable in the root makefile. This is an incomplete list:
|
# configure script, or various feature flags. Look at the 'rockbox-info.txt'
|
||||||
# Target Target string
|
# file in your build directory for a list of all of the feature flags
|
||||||
# iriver
|
# supported by your build; typicall there are well over a dozen.
|
||||||
# H100/H110/H115 iriverh100
|
#
|
||||||
# H120/H140 iriverh120
|
# It is possible for there to be multiple matches. When this is deteted
|
||||||
# H320/H340 iriverh300
|
# the build system will treat this as a failure. There is a special
|
||||||
# H10 iriverh10
|
# case where this is intentional. Some strings refer to key actions that
|
||||||
# iaudio/Cowon
|
# may be unique for a given device, but we need a way to flag an error
|
||||||
# X5 iaudiox5
|
# if that is not properly defined. In this case, the feature flag
|
||||||
# M5 iaudiom5
|
# is given a special value "FALLBACK". As an example of this, see
|
||||||
# D2 cowond2*
|
# the 'rtc' string of of LANG_TIME_SET_BUTTON.
|
||||||
# ipod
|
####
|
||||||
# All iPods ipod*
|
|
||||||
# 4G Color/Photo ipodcolor
|
|
||||||
# Nano ipodnano1g
|
|
||||||
# Video (5G) ipodvideo
|
|
||||||
# 3G ipod3g
|
|
||||||
# 4G gray ipod4g
|
|
||||||
# mini ipodmini1g
|
|
||||||
# mini 2G ipodmini2g
|
|
||||||
# Toshiba
|
|
||||||
# All gigabeats gigabeat*
|
|
||||||
# Gigabeat Fxx gigabeatfx
|
|
||||||
# Gigabeat Sxx gigabeats
|
|
||||||
# Sandisk
|
|
||||||
# Sansa E200 sansae200*
|
|
||||||
# Sansa C200 sansac200*
|
|
||||||
# Sansa Fuze sansafuze*
|
|
||||||
# Sansa Clip sansaclip*
|
|
||||||
# Olympus
|
|
||||||
# m:robe 100 mrobe100
|
|
||||||
# m:robe 500 mrobe500
|
|
||||||
# Mpio
|
|
||||||
# HD200 mpiohd200
|
|
||||||
# HD300 mpiohd300
|
|
||||||
# Packard Bell
|
|
||||||
# Vibe 500 vibe500
|
|
||||||
# Philips
|
|
||||||
# GoGear SA9200 gogearsa9200
|
|
||||||
# Samsung
|
|
||||||
# YH820/YH920/YH925 samsungyh*
|
|
||||||
# First item will be shown when P2STR is passed a NULL pointer
|
# First item will be shown when P2STR is passed a NULL pointer
|
||||||
<phrase>
|
<phrase>
|
||||||
id: LANG_ROCKBOX_TITLE
|
id: LANG_ROCKBOX_TITLE
|
||||||
|
@ -3687,7 +3659,7 @@
|
||||||
iriverh100,iriverh120,iriverh300: "NAVI = Set"
|
iriverh100,iriverh120,iriverh300: "NAVI = Set"
|
||||||
mpiohd300: "ENTER = Set"
|
mpiohd300: "ENTER = Set"
|
||||||
mrobe500: "HEART = Set"
|
mrobe500: "HEART = Set"
|
||||||
rtc: "ON = Set"
|
rtc: "FALLBACK"
|
||||||
vibe500: "OK = Set"
|
vibe500: "OK = Set"
|
||||||
</source>
|
</source>
|
||||||
<dest>
|
<dest>
|
||||||
|
@ -3697,7 +3669,7 @@
|
||||||
iriverh100,iriverh120,iriverh300: "NAVI = Set"
|
iriverh100,iriverh120,iriverh300: "NAVI = Set"
|
||||||
mpiohd300: "ENTER = Set"
|
mpiohd300: "ENTER = Set"
|
||||||
mrobe500: "HEART = Set"
|
mrobe500: "HEART = Set"
|
||||||
rtc: "ON = Set"
|
rtc: "FALLBACK"
|
||||||
vibe500: "OK = Set"
|
vibe500: "OK = Set"
|
||||||
</dest>
|
</dest>
|
||||||
<voice>
|
<voice>
|
||||||
|
@ -3719,7 +3691,7 @@
|
||||||
iriverh10,iriverh10_5gb,sansae200*,sansafuze*: "PREV = Revert"
|
iriverh10,iriverh10_5gb,sansae200*,sansafuze*: "PREV = Revert"
|
||||||
iriverh100,iriverh120,iriverh300: "STOP = Revert"
|
iriverh100,iriverh120,iriverh300: "STOP = Revert"
|
||||||
mrobe100: "DISPLAY = Revert"
|
mrobe100: "DISPLAY = Revert"
|
||||||
rtc: "OFF = Revert"
|
rtc: "FALLBACK"
|
||||||
samsungyh*: "REW = Revert"
|
samsungyh*: "REW = Revert"
|
||||||
vibe500: "CANCEL = Revert"
|
vibe500: "CANCEL = Revert"
|
||||||
</source>
|
</source>
|
||||||
|
@ -3733,7 +3705,7 @@
|
||||||
iriverh10,iriverh10_5gb,sansae200*,sansafuze*: "PREV = Revert"
|
iriverh10,iriverh10_5gb,sansae200*,sansafuze*: "PREV = Revert"
|
||||||
iriverh100,iriverh120,iriverh300: "STOP = Revert"
|
iriverh100,iriverh120,iriverh300: "STOP = Revert"
|
||||||
mrobe100: "DISPLAY = Revert"
|
mrobe100: "DISPLAY = Revert"
|
||||||
rtc: "OFF = Revert"
|
rtc: "FALLBACK"
|
||||||
samsungyh*: "REW = Revert"
|
samsungyh*: "REW = Revert"
|
||||||
vibe500: "CANCEL = Revert"
|
vibe500: "CANCEL = Revert"
|
||||||
</dest>
|
</dest>
|
||||||
|
|
|
@ -235,6 +235,7 @@ sub readenglish {
|
||||||
my $withindest;
|
my $withindest;
|
||||||
my $numphrases = 0;
|
my $numphrases = 0;
|
||||||
my $numusers = 1; # core is already in the users map
|
my $numusers = 1; # core is already in the users map
|
||||||
|
my $deststr;
|
||||||
|
|
||||||
while(<ENG>) {
|
while(<ENG>) {
|
||||||
|
|
||||||
|
@ -243,8 +244,7 @@ sub readenglish {
|
||||||
|
|
||||||
if($_ =~ /^ *\<phrase\>/) {
|
if($_ =~ /^ *\<phrase\>/) {
|
||||||
# this is the start of a phrase
|
# this is the start of a phrase
|
||||||
}
|
} elsif($_ =~ /\<\/phrase\>/) {
|
||||||
elsif($_ =~ /\<\/phrase\>/) {
|
|
||||||
|
|
||||||
# if id is something, when we count and store this phrase
|
# if id is something, when we count and store this phrase
|
||||||
if($id) {
|
if($id) {
|
||||||
|
@ -253,8 +253,7 @@ sub readenglish {
|
||||||
# Assign an ID number to this entry
|
# Assign an ID number to this entry
|
||||||
$idmap[$user]{$id}=$vidnum[$user];
|
$idmap[$user]{$id}=$vidnum[$user];
|
||||||
$vidnum[$user]++;
|
$vidnum[$user]++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
# Assign an ID number to this entry
|
# Assign an ID number to this entry
|
||||||
$idmap[$user]{$id}=$idnum[$user];
|
$idmap[$user]{$id}=$idnum[$user];
|
||||||
$idnum[$user]++;
|
$idnum[$user]++;
|
||||||
|
@ -266,8 +265,7 @@ sub readenglish {
|
||||||
}
|
}
|
||||||
undef @phrase;
|
undef @phrase;
|
||||||
$id="";
|
$id="";
|
||||||
}
|
} elsif($_ ne "\n") {
|
||||||
elsif($_ ne "\n") {
|
|
||||||
# gather everything related to this phrase
|
# gather everything related to this phrase
|
||||||
push @phrase, $_;
|
push @phrase, $_;
|
||||||
if($_ =~ /^ *\<dest\>/i) {
|
if($_ =~ /^ *\<dest\>/i) {
|
||||||
|
@ -278,12 +276,10 @@ sub readenglish {
|
||||||
$withindest=0;
|
$withindest=0;
|
||||||
|
|
||||||
if($deststr && ($deststr !~ /^none\z/i)) {
|
if($deststr && ($deststr !~ /^none\z/i)) {
|
||||||
# we unconditionally always use all IDs when the "update"
|
die ("Missing specific target match for $maybeid\n") if ($deststr eq '"FALLBACK"');
|
||||||
# feature is used
|
|
||||||
$id = $maybeid;
|
$id = $maybeid;
|
||||||
# print "DEST: use this id $id\n";
|
# print "DEST: use this id $id\n";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
# print "skip $maybeid for $name\n";
|
# print "skip $maybeid for $name\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,11 +289,24 @@ sub readenglish {
|
||||||
# model name isn't "ours"
|
# model name isn't "ours"
|
||||||
dest($_, $name, $val);
|
dest($_, $name, $val);
|
||||||
|
|
||||||
if($dest) {
|
## If $dest is nonnull (ie we have a match for this target)
|
||||||
# Store the current dest string. If this target matches
|
## if $deststr is null, accept
|
||||||
# multiple strings, it will get updated several times.
|
## if $name is '*', accept
|
||||||
$deststr = $dest;
|
## if $name is not '*' and $deststr is not null, COMPLAIN.
|
||||||
}
|
|
||||||
|
if ($dest) {
|
||||||
|
if (!$deststr) {
|
||||||
|
$deststr = $dest;
|
||||||
|
} elsif ($name eq '*') {
|
||||||
|
$deststr = $dest;
|
||||||
|
} elsif ($deststr ne 'none' && $val ne '"FALLBACK"') {
|
||||||
|
die("multiple matches on $maybeid ($name:$val / $deststr)\n");
|
||||||
|
} elsif ($deststr ne 'none' && $val eq '"FALLBACK"') {
|
||||||
|
# Ignore FALLBACK row if we already have a match
|
||||||
|
} else {
|
||||||
|
$deststr = $dest;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -555,6 +555,7 @@ foreach my $id (@finalorder) {
|
||||||
print $fh " <source>\n";
|
print $fh " <source>\n";
|
||||||
foreach my $tgt (sort(keys(%lp))) {
|
foreach my $tgt (sort(keys(%lp))) {
|
||||||
my $w = NFC($lp{$tgt});
|
my $w = NFC($lp{$tgt});
|
||||||
|
next if ($w eq 'FALLBACK');
|
||||||
if ($w eq 'none') {
|
if ($w eq 'none') {
|
||||||
print $fh " $tgt: $w\n";
|
print $fh " $tgt: $w\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -568,6 +569,7 @@ foreach my $id (@finalorder) {
|
||||||
print $fh " <dest>\n";
|
print $fh " <dest>\n";
|
||||||
foreach my $tgt (sort(keys(%lp))) {
|
foreach my $tgt (sort(keys(%lp))) {
|
||||||
my $w = NFC($lp{$tgt});
|
my $w = NFC($lp{$tgt});
|
||||||
|
next if ($w eq 'FALLBACK');
|
||||||
if ($w eq 'none') {
|
if ($w eq 'none') {
|
||||||
print $fh " $tgt: $w\n";
|
print $fh " $tgt: $w\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -581,6 +583,7 @@ foreach my $id (@finalorder) {
|
||||||
print $fh " <voice>\n";
|
print $fh " <voice>\n";
|
||||||
foreach my $tgt (sort(keys(%lp))) {
|
foreach my $tgt (sort(keys(%lp))) {
|
||||||
my $w = NFC($lp{$tgt});
|
my $w = NFC($lp{$tgt});
|
||||||
|
next if ($w eq 'FALLBACK');
|
||||||
if ($w eq 'none') {
|
if ($w eq 'none') {
|
||||||
print $fh " $tgt: $w\n";
|
print $fh " $tgt: $w\n";
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue