summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-21 00:34:37 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-21 11:59:47 +0000
commit688c89cfe13658dc0c36c67235ed968e286d78bf (patch)
treed365eac0ec1211483583c6c6b8b71c4d36ab4469 /tools
parent25f9601d7bd6f98110e646d7d2b769d26b46bfca (diff)
downloadrockbox-688c89cfe13658dc0c36c67235ed968e286d78bf.tar.gz
rockbox-688c89cfe13658dc0c36c67235ed968e286d78bf.tar.bz2
rockbox-688c89cfe13658dc0c36c67235ed968e286d78bf.zip
genlang: More voice-related fixes.
* Use consistent ID numbering * Use consistent logic for voicelist and voicebin files * Fix situations where English <-> English would fail in strange ways * Delete leftover tmpfile. * Off-by-one error in voice validation code * Off-by-one error in voicelist generation Change-Id: Ib3cea2c6612138b1cbe614dacbe51000199cc9ad
Diffstat (limited to 'tools')
-rwxr-xr-xtools/genlang68
1 files changed, 20 insertions, 48 deletions
diff --git a/tools/genlang b/tools/genlang
index a5f62bf3ca..e943492067 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -794,7 +794,7 @@ elsif($binary || $binvoice) {
# loop over the target phrases
# This loops over the strings in the translated language file order
my @ids = ((0 .. ($idcount[$_]-1)));
- push @ids, (0x8000 .. ($voiceid[$_]-1));
+ push @ids, (0x8001 .. ($voiceid[$_]-1));
for $n (@ids) {
my $name=$idnum[$_][$n]; # get the ID
my $dest = $dest{$name}; # get the destination phrase
@@ -829,66 +829,38 @@ elsif($voiceout) {
my @engl;
- # This loops over the strings in the translated language file order
- my @ids = ((0 .. ($idcount[$users{"core"}]-1)));
- push @ids, (0x8000 .. ($voiceid[$users{"core"}]-1));
-
- #for my $id (@ids) {
- # print "$id\n";
- #}
-
- for $i (@ids) {
- my $name=$idnum[$users{"core"}][$i]; # get the ID
- my $dest = $voice{$name}; # get the destination voice string
-
- if($dest) {
- $dest =~ s/^\"(.*)\"\s*$/$1/g; # cut off quotes
-
- # Now, make sure we get the number from the english sort order:
- $idnum = $idmap[$users{"core"}]{$name};
-
- if(length($idnum)) {
- $engl[$idnum] = $i;
+ for (keys %users) {
+ # loop over the target phrases
+ # This loops over the strings in the translated language file order
+ my @ids = ((0 .. ($idcount[$_]-1)));
+ push @ids, (0x8001 .. ($voiceid[$_]-1));
+ for $n (@ids) {
+ my $name=$idnum[$_][$n]; # get the ID
+ my $dest = $dest{$name}; # get the destination phrase
+ my $voice = $voice{$name}; # get the destination voice string
- #print "Input index $i output index $idnum\n";
- }
- else {
- # not used, mark it so
- $engl[$i] = -1
+ if($voice) {
+ $voice =~ s/^\"(.*)\"\s*$/$1/g; # cut off quotes
+ # Now, make sure we get the number from the english sort order:
+ $idnum = $idmap[$_]{$name};
+ $engl[$idnum] = "#$idnum ($n)\nid: $name\nvoice: \"$voice\"\n";
}
-
}
}
- for my $i (@ids) {
-
- my $o = $engl[$i];
-
- if(($o < 0) || !length($o)) {
- if($i < 0x8000) {
- print "#$i\nid: NOT_USED_$i\nvoice: \"\"\n";
- }
- else {
- print "#$i\nid: VOICE_NOT_USED_$i\nvoice: \"\"\n";
- }
- next;
- }
-
- my $name=$idnum[$users{"core"}][$o]; # get the ID
- my $dest = $voice{$name}; # get the destination voice string
-
- print "#$i ($o)\nid: $name\nvoice: $dest\n";
+ # Print the list in the the English sort order
+ for (@engl) {
+ print $_;
}
-
}
if($verbose) {
my $num_str = 0;
-
+
for (keys %users) {
$num_str += $idcount[$_];
}
-
+
printf("%d ID strings scanned\n", $num_str);
print "* head *\n";