blob: 396b00bc2b6cb4c22cd7546454c4918ed6720aca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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;
}
|