summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-02-01 01:35:17 +0000
committerJens Arnold <amiconn@rockbox.org>2005-02-01 01:35:17 +0000
commit9bfcc71faab9306189ec94892a18de5c0ce45e3d (patch)
tree8ef34dccc7c3681ba197cd187f0bfa65a578b25e /tools
parentabfd29ab2ceb460b3d347252f153d22405af5f29 (diff)
downloadrockbox-9bfcc71faab9306189ec94892a18de5c0ce45e3d.zip
rockbox-9bfcc71faab9306189ec94892a18de5c0ce45e3d.tar.gz
rockbox-9bfcc71faab9306189ec94892a18de5c0ce45e3d.tar.bz2
rockbox-9bfcc71faab9306189ec94892a18de5c0ce45e3d.tar.xz
Bug fixes & enhancements: (1) Don't change voice: strings back to english just because they are different. They are supposed to be that way. (2) Instead, put a comment and set voice: back to english if one of the following conditions are met: (2a) It's a voice only id, and the description changed (2b) It's a standard id, the eng: string changed, and the english and/or translated voice: string is not empty. (3) Append new ids in the same order as they appear in english.lang, for better maintenance.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5731 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/uplang40
1 files changed, 29 insertions, 11 deletions
diff --git a/tools/uplang b/tools/uplang
index 4e581f6..d290a79 100755
--- a/tools/uplang
+++ b/tools/uplang
@@ -8,7 +8,7 @@ MOO
exit;
}
-my %ids;
+my %ids, @ids;
open(ENG, "<$ARGV[0]");
while(<ENG>) {
if($_ =~ /^ *\#/) {
@@ -29,6 +29,7 @@ while(<ENG>) {
$all{$set{'id'}, 'voice'}=$set{'voice'};
$ids{$set{'id'}}=1;
+ push @ids, $set{'id'};
undef %set;
}
}
@@ -62,21 +63,37 @@ while(<NEW>) {
if($set{'desc'} ne $all{$set{'id'}, 'desc'}) {
print "### Description changed! Previous description was:\n",
"### \"".$set{'desc'}."\"\n";
- $set{'desc'} = $all{$set{'id'}, 'desc'};
+ print "desc: ".$all{$set{'id'}, 'desc'}."\n";
+ }
+ else {
+ print "desc: ".$set{'desc'}."\n";
}
- print "desc: ".$set{'desc'}."\n";
if($set{'eng'} ne $all{$set{'id'}, 'eng'}) {
print "### English phrase was changed! Previous translation was made on:\n",
"### ".$set{'eng'}."\n";
- $set{'eng'} = $all{$set{'id'}, 'eng'};
+ print "eng: ".$all{$set{'id'}, 'eng'}."\n";
+ }
+ else {
+ print "eng: ".$set{'eng'}."\n";
}
- print "eng: ".$set{'eng'}."\n";
- if($set{'voice'} ne $all{$set{'id'}, 'voice'}) {
- print "### Voice string was changed! Previous version was:\n",
- "### ".$set{'voice'}."\n";
- $set{'voice'} = $all{$set{'id'}, 'voice'};
+ if($set{'id'} =~ /^VOICE_/) { # voice only, compare desc:
+ if($set{'desc'} ne $all{$set{'id'}, 'desc'}) {
+ print "### Voice only: description changed! Voice set to english. Previous voice was:\n",
+ "### ".$set{'voice'}."\n";
+ $set{'voice'} = $all{$set{'id'}, 'voice'};
+ }
+ }
+ else { # standard entry, compare eng:
+ if($set{'eng'} ne $all{$set{'id'}, 'eng'}
+ #only if either original or translated voice: is non-empty
+ and ($set{'voice'} !~ /^(\"\")? *$/
+ or $all{$set{'id'}, 'voice'} !~ /^(\"\")? *$/)) {
+ print "### English phrase was changed! Voice set to english. Previous voice was:\n",
+ "### ".$set{'voice'}."\n";
+ $set{'voice'} = $all{$set{'id'}, 'voice'};
+ }
}
print "voice: ".$set{'voice'}."\n";
@@ -88,14 +105,15 @@ while(<NEW>) {
}
close(NEW);
-# output new phrases not already translated
-for(sort keys %ids) {
+# output new phrases not already translated , in english.lang order
+for(@ids) {
if($ids{$_}) {
my $id=$_;
print "\nid: $_\n";
print "desc: ".$all{$id, 'desc'}."\n";
print "eng: ".$all{$id, 'eng'}."\n";
print "### Not previously translated\n";
+ print "voice: ".$all{$id, 'voice'}."\n";
print "new: \n";
}
}