blob: 827ceb394977b5946e98e01344210230887da074 (
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
|
#!/usr/bin/perl
if(!$ARGV[0]) {
print <<MOO
Usage: lang.pl <file>
MOO
;
exit;
}
print <<MOO
/* This file was automaticly generated using genlan */
/*
* The str() macro/functions is how to access strings that might be
* translated. Use it like str(MACRO) and except a string to be
* returned!
*/
#define str(x) x
MOO
;
open(LANG, "<$ARGV[0]");
while(<LANG>) {
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
if(!$value) {
# if not set, get the english version
$value = $set{'eng'};
}
print "#define ".$set{'id'}." $value\n";
undef %set;
}
}
}
close(LANG);
|