FS#6652 fix attempt. Make the phrase id counting take the dest pattern into
account so that the binary and source code output gets the same numbering. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13443 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0037a1b648
commit
f22e6a5964
1 changed files with 42 additions and 14 deletions
|
@ -182,6 +182,8 @@ if($english) {
|
||||||
open(ENG, "<$english") || die "can't open $english";
|
open(ENG, "<$english") || die "can't open $english";
|
||||||
my @phrase;
|
my @phrase;
|
||||||
my $id;
|
my $id;
|
||||||
|
my $maybeid;
|
||||||
|
my $withindest;
|
||||||
while(<ENG>) {
|
while(<ENG>) {
|
||||||
|
|
||||||
# get rid of DOS newlines
|
# get rid of DOS newlines
|
||||||
|
@ -191,28 +193,54 @@ if($english) {
|
||||||
# this is the start of a phrase
|
# this is the start of a phrase
|
||||||
}
|
}
|
||||||
elsif($_ =~ /^ *\<\/phrase\>/) {
|
elsif($_ =~ /^ *\<\/phrase\>/) {
|
||||||
# this is the end of a phrase, add it to the english hash
|
|
||||||
$english{$id}=join("", @phrase);
|
# if id is something, when we count and store this phrase
|
||||||
|
if($id) {
|
||||||
|
# voice-only entries get a difference range
|
||||||
|
if($id =~ /^VOICE_/) {
|
||||||
|
# Assign an ID number to this entry
|
||||||
|
$idmap{$id}=$vidnum;
|
||||||
|
$vidnum++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Assign an ID number to this entry
|
||||||
|
$idmap{$id}=$idnum;
|
||||||
|
$idnum++;
|
||||||
|
print STDERR "DEST: bumped idnum to $idnum\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# this is the end of a phrase, add it to the english hash
|
||||||
|
$english{$id}=join("", @phrase);
|
||||||
|
}
|
||||||
undef @phrase;
|
undef @phrase;
|
||||||
|
$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) {
|
||||||
|
$withindest=1;
|
||||||
|
}
|
||||||
|
elsif($withindest && ($_ =~ /^ *\<\/dest\>/i)) {
|
||||||
|
$withindest=0;
|
||||||
|
}
|
||||||
|
elsif($withindest && ($_ =~ / *([^:]+): *(.*)/)) {
|
||||||
|
my ($name, $val)=($1, $2);
|
||||||
|
$dest=""; # in case it is left untouched for when the
|
||||||
|
# model name isn't "our"
|
||||||
|
dest($_, $name, $val);
|
||||||
|
|
||||||
|
print STDERR "DEST: \"$dest\" for $name / $id\n";
|
||||||
|
|
||||||
|
if($dest && ($dest ne "none")) {
|
||||||
|
$id = $maybeid;
|
||||||
|
print STDERR "DEST: use this id $id\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_ =~ /^ *id: ([^ \t\n]+)/i) {
|
if($_ =~ /^ *id: ([^ \t\n]+)/i) {
|
||||||
$id=$1;
|
$maybeid=$1;
|
||||||
# voice-only entries get a difference range
|
|
||||||
if($id =~ /^VOICE_/) {
|
|
||||||
# Assign an ID number to this entry
|
|
||||||
$idmap{$id}=$vidnum;
|
|
||||||
$vidnum++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
# Assign an ID number to this entry
|
|
||||||
$idmap{$id}=$idnum;
|
|
||||||
$idnum++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(ENG);
|
close(ENG);
|
||||||
|
|
Loading…
Reference in a new issue