summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-03-21 12:56:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-03-21 12:56:25 +0000
commit464c757f0da7ccacbb84f63ef92cda4898b6d9c3 (patch)
treea61e4175b0e5b26cbff3a411c144041d920455b2 /tools
parent0077b0678fad27a82f16ed7c63f8fe1e13dcd92f (diff)
downloadrockbox-464c757f0da7ccacbb84f63ef92cda4898b6d9c3.tar.gz
rockbox-464c757f0da7ccacbb84f63ef92cda4898b6d9c3.tar.bz2
rockbox-464c757f0da7ccacbb84f63ef92cda4898b6d9c3.zip
initial take at upgrade script from v1 to v2 file format
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9162 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/langv1tov254
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/langv1tov2 b/tools/langv1tov2
new file mode 100755
index 0000000000..61f36b29df
--- /dev/null
+++ b/tools/langv1tov2
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -s
+
+while(<STDIN>) {
+ $line++;
+ if($_ =~ / *\#/) {
+ # comment
+ next;
+ }
+ # get rid of DOS newlines
+ $_ =~ s/\r//g;
+ if($_ =~ / *([a-z]+): *(.*)/) {
+ ($var, $value) = ($1, $2);
+ # print "$var => $value\n";
+
+ $set{$var} = $value;
+
+ if( (($var eq "new") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
+ (($var eq "voice") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
+ (($var eq "eng") && ($value !~ /^\"(.*)\"\W*$/)) ) {
+ print "$input:$line:missing quotes for ".$set{'id'}."\n";
+ $errors++;
+ next;
+ }
+
+ if($var eq "new") {
+ # the last one for a single phrase
+
+ if(!$value || ($value eq "\"\"") ) {
+ # if not set, get the english version
+ $value = $set{'eng'};
+ }
+ print <<MOO
+<phrase>
+ id: $set{'id'}
+ desc: $set{'desc'}
+ user:
+ <source>
+ *: $set{'eng'}
+ </source>
+ <dest>
+ *: $value
+ </dest>
+ <voice>
+ *: $set{'voice'}
+ </voice>
+</phrase>
+MOO
+;
+ undef %set;
+ }
+
+ }
+
+}