5 Usage: uplang <english file> <translated file>
12 open(ENG
, "<$ARGV[0]");
19 if($_ =~ /^ *([a-z]+): *(.*)/) {
20 ($var, $value) = ($1, $2);
21 # print "$var => $value\n";
26 # the last one for a single phrase
27 $all{$set{'id'}, 'desc'}=$set{'desc'};
28 $all{$set{'id'}, 'eng'}=$set{'eng'};
29 $all{$set{'id'}, 'voice'}=$set{'voice'};
32 push @ids, $set{'id'};
41 open(NEW
, "<$ARGV[1]");
47 if($_ !~ /^ *\#\#\#/) {
48 # no special ### comment -> keep it
59 if($_ =~ /^ *([a-z]+): *(.*)/) {
60 ($var, $value) = ($1, $2);
65 # the last one for a single phrase
67 if(!$ids{$set{'id'}}) {
68 print "\n### ".$set{'id'}." was not found in the english file!\n";
72 print "\nid: ".$set{'id'}."\n";
74 if($set{'desc'} ne $all{$set{'id'}, 'desc'}) {
75 print "### Description changed! Previous description was:\n",
76 "### \"".$set{'desc'}."\"\n";
77 print "desc: ".$all{$set{'id'}, 'desc'}."\n";
80 print "desc: ".$set{'desc'}."\n";
83 if($set{'eng'} ne $all{$set{'id'}, 'eng'}) {
84 print "### English phrase was changed! Previous translation was made on:\n",
85 "### ".$set{'eng'}."\n";
86 print "eng: ".$all{$set{'id'}, 'eng'}."\n";
89 print "eng: ".$set{'eng'}."\n";
92 if($set{'id'} =~ /^VOICE_/) { # voice only, compare desc:
93 if($set{'desc'} ne $all{$set{'id'}, 'desc'}) {
94 print "### Voice only: description changed! Voice set to english. Previous voice was:\n",
95 "### ".$set{'voice'}."\n";
96 $set{'voice'} = $all{$set{'id'}, 'voice'};
99 else { # standard entry, compare eng:
100 if($set{'eng'} ne $all{$set{'id'}, 'eng'}
101 #only if either original or translated voice: is non-empty
102 and ($set{'voice'} !~ /^(\"\")? *$/
103 or $all{$set{'id'}, 'voice'} !~ /^(\"\")? *$/)) {
104 print "### English phrase was changed! Voice set to english. Previous voice was:\n",
105 "### ".$set{'voice'}."\n";
106 $set{'voice'} = $all{$set{'id'}, 'voice'};
109 if($set{'voice'} =~ /^(\"\")? *$/
110 and $all{$set{'id'}, 'voice'} !~ /^(\"\")? *$/) {
111 print "### Voice not found in previous translation. Set to english.\n";
112 $set{'voice'} = $all{$set{'id'}, 'voice'};
114 print "voice: ".$set{'voice'}."\n";
116 print "new: ".$set{'new'}."\n";
125 # output new phrases not already translated , in english.lang order
130 print "desc: ".$all{$id, 'desc'}."\n";
131 print "eng: ".$all{$id, 'eng'}."\n";
132 print "### Not previously translated\n";
133 print "voice: ".$all{$id, 'voice'}."\n";