summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-09-16 15:02:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-09-16 15:02:11 +0000
commita07a236c0f1119961203bfdfda8df4fb41ad2bb8 (patch)
treeadfc40b2f65127b750037bdbf291dd2396d17092
parente19f763d791333193080bfd088c9b29ea7129a61 (diff)
update a .lang file from a .lang "master file"
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2302 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/uplang76
1 files changed, 76 insertions, 0 deletions
diff --git a/tools/uplang b/tools/uplang
new file mode 100755
index 0000000000..f63edd372a
--- /dev/null
+++ b/tools/uplang
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+
+if(!$ARGV[0]) {
+ print <<MOO
+Usage: lang.pl <english file> <translated file>
+MOO
+;
+ exit;
+}
+
+open(ENG, "<$ARGV[0]");
+while(<ENG>) {
+ if($_ =~ / *\#/) {
+ # comment
+ next;
+ }
+ if($_ =~ / *([a-z]+): *(.*)/) {
+ ($var, $value) = ($1, $2);
+ # print "$var => $value\n";
+
+ $set{$var} = $value;
+
+ if($var eq "new") {
+ # the last one for a single phrase
+ $all{$set{'id'}, 'desc'}=$set{'desc'};
+ $all{$set{'id'}, 'eng'}=$set{'eng'};
+
+ $ids{$set{'id'}}=1;
+ undef %set;
+ }
+ }
+}
+close(ENG);
+
+undef %set;
+open(NEW, "<$ARGV[1]");
+while(<NEW>) {
+ if($_ =~ / *\#/) {
+ # comment
+ next;
+ }
+ if($_ =~ / *([a-z]+): *(.*)/) {
+ ($var, $value) = ($1, $2);
+
+ $set{$var} = $value;
+
+ if($var eq "new") {
+ # the last one for a single phrase
+
+ print "\nid: ".$set{'id'}."\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: ".$set{'eng'}."\n";
+ print "new: ".$set{'new'}."\n";
+
+ $ids{$set{'id'}}=0;
+ }
+ }
+}
+close(NEW);
+
+# output new phrases not already translated
+for(sort keys %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 "new: \n";
+ }
+}