From 9bfcc71faab9306189ec94892a18de5c0ce45e3d Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Tue, 1 Feb 2005 01:35:17 +0000 Subject: 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 --- tools/uplang | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tools/uplang b/tools/uplang index 4e581f600e..d290a79d37 100755 --- a/tools/uplang +++ b/tools/uplang @@ -8,7 +8,7 @@ MOO exit; } -my %ids; +my %ids, @ids; open(ENG, "<$ARGV[0]"); while() { if($_ =~ /^ *\#/) { @@ -29,6 +29,7 @@ while() { $all{$set{'id'}, 'voice'}=$set{'voice'}; $ids{$set{'id'}}=1; + push @ids, $set{'id'}; undef %set; } } @@ -62,21 +63,37 @@ while() { 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() { } 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"; } } -- cgit v1.2.3