2 # Based on umtrans.pl version 1.0 (April 8, 2001) by Clifford Adams.
3 # Extracts translation strings from wiki script and extensions.
5 binmode(STDIN
, ':utf8');
6 binmode(STDOUT
, ':utf8');
10 oddtrans - complement translation tables for Oddmuse
13 oddtrans [OPTIONS]... [FILE]...
17 Read all the calls to T(), Ts(), and Tss() from all FILEs, and print
18 them on standard output, followed by their translation (usually the
19 empty string unless you use -l to load a library).
22 load a library from a previous run; you can use multiple -l
26 oddtrans -l german-utf8.pl wiki.pl modules/*.pl > new-german-utf8.pl
33 while ($arg =~ /^-l/) {
34 $file = substr($arg, 3);
35 $file = shift unless $file;
36 die $help unless -f
$file;
38 do $file or die "Cannot do $file";
39 foreach $key (keys %Translate) {
40 $backup{$key} = $Translate{$key};
45 unshift(@ARGV,$arg); # shove the last one back because it is not -l!
53 $result = $Translate{$string} if (defined($Translate{$string}));
54 return ' ' if ($seen{$string});
56 print $string . "\n" . $result . "\n";
60 print '%Translate = split(/\n/,<<END_OF_TRANSLATION);' . "\n";
62 s/Ts?s?\(\'([^']+)/&trans($1)/ge;
63 s/Ts?s?\(\"([^"]+)/&trans($1)/ge;
66 print "END_OF_TRANSLATION\n";