diff options
author | akshay-c | 2019-01-30 12:23:44 +0530 |
---|---|---|
committer | akshay-c | 2019-01-30 12:23:44 +0530 |
commit | 4196481f74afb84e5cc59cdf00c06c1ca1becab7 (patch) | |
tree | b531deb0466897691f08f9076b7012592f026664 /ldmicro/lang-tables.pl | |
download | LDmicroQt-4196481f74afb84e5cc59cdf00c06c1ca1becab7.tar.gz LDmicroQt-4196481f74afb84e5cc59cdf00c06c1ca1becab7.tar.bz2 LDmicroQt-4196481f74afb84e5cc59cdf00c06c1ca1becab7.zip |
First commit
Diffstat (limited to 'ldmicro/lang-tables.pl')
-rw-r--r-- | ldmicro/lang-tables.pl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ldmicro/lang-tables.pl b/ldmicro/lang-tables.pl new file mode 100644 index 0000000..396b00b --- /dev/null +++ b/ldmicro/lang-tables.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +$t = ''; + +for $file (sort <lang-*.txt>) { + open(IN, $file); + + $name = $file; + $name =~ s#lang-##; + $name =~ s#(.)#uc($1)#e; + $name =~ s#\.txt##; + $nameUc = uc($name); + + print "#ifdef LDLANG_$nameUc\n"; + print "static LangTable Lang${name}Table[] = {\n"; + + $engl = 1; + $. = 0; + while(<IN>) { + chomp; + + if(/^\s*$/) { + if($engl) { + next; + } else { + die "blank line mid-translation at $file, $.\n"; + } + } + + if($engl) { + $toTranslate = $_; + $engl = 0; + } else { + $translated = $_; + + print " { $toTranslate, $translated },\n"; + $engl = 1; + } + } + + print "};\n"; + + print <<EOT; +static Lang Lang$name = { + Lang${name}Table, sizeof(Lang${name}Table)/sizeof(Lang${name}Table[0]) +}; +#endif +EOT + + close FILE; +} + |