Update Thai translation - FS #11474 by Phinitnun Chanasabaeng
[kugel-rb.git] / tools / langv1tov2
blob61f36b29df4eb7a68dfbd748130519bf95fb8dad
1 #!/usr/bin/perl -s
3 while(<STDIN>) {
4 $line++;
5 if($_ =~ / *\#/) {
6 # comment
7 next;
9 # get rid of DOS newlines
10 $_ =~ s/\r//g;
11 if($_ =~ / *([a-z]+): *(.*)/) {
12 ($var, $value) = ($1, $2);
13 # print "$var => $value\n";
15 $set{$var} = $value;
17 if( (($var eq "new") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
18 (($var eq "voice") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
19 (($var eq "eng") && ($value !~ /^\"(.*)\"\W*$/)) ) {
20 print "$input:$line:missing quotes for ".$set{'id'}."\n";
21 $errors++;
22 next;
25 if($var eq "new") {
26 # the last one for a single phrase
28 if(!$value || ($value eq "\"\"") ) {
29 # if not set, get the english version
30 $value = $set{'eng'};
32 print <<MOO
33 <phrase>
34 id: $set{'id'}
35 desc: $set{'desc'}
36 user:
37 <source>
38 *: $set{'eng'}
39 </source>
40 <dest>
41 *: $value
42 </dest>
43 <voice>
44 *: $set{'voice'}
45 </voice>
46 </phrase>
47 MOO
49 undef %set;