| 22 |
|
|
| 23 |
|
|
| 24 |
# This should contain all languages |
# This should contain all languages |
| 25 |
@langs = ("arabic", "chinese", "croatian", "danish", "dutch", "english", |
%langs = ( |
| 26 |
"esperanto", "finnish", "french", "german", "hungarian", |
"ar" => "arabic", |
| 27 |
"italian", "japanese", "korean", "norwegian", "polish", |
"zh" => "chinese", |
| 28 |
"portuguese", "romanian", "russian", "spanish", "swedish", |
"hr" => "croatian", |
| 29 |
"turkish"); |
"da" => "danish", |
| 30 |
|
"nl" => "dutch", |
| 31 |
|
"el" => "hellas", |
| 32 |
|
"en" => "english", |
| 33 |
|
"eo" => "esperanto", |
| 34 |
|
"fi" => "finnish", |
| 35 |
|
"fr" => "french", |
| 36 |
|
"de" => "german", |
| 37 |
|
"hu" => "hungarian", |
| 38 |
|
"it" => "italian", |
| 39 |
|
"ja" => "japanese", |
| 40 |
|
"ko" => "korean", |
| 41 |
|
"no" => "norwegian", |
| 42 |
|
"pl" => "polish", |
| 43 |
|
"pt" => "portuguese", |
| 44 |
|
"ro" => "romanian", |
| 45 |
|
"ru" => "russian", |
| 46 |
|
"es" => "spanish", |
| 47 |
|
"sv" => "swedish", |
| 48 |
|
"tr" => "turkish"); |
| 49 |
|
|
| 50 |
|
@langs = values(%langs); |
| 51 |
|
|
| 52 |
# Set this to 1 for debugging |
# Set this to 1 for debugging |
| 53 |
$debug = 1; |
$debug = 0; |
| 54 |
|
|
| 55 |
sub rebuild { |
sub rebuild { |
| 56 |
my $file = shift; |
my $file = shift; |
| 57 |
$now = time; |
$now = time; |
| 58 |
print "touching $file\n"; |
print "touching $file\n" if $debug; |
| 59 |
utime $now, $now, $file or die "$file: $!"; |
utime $now, $now, $file or die "$file: $!"; |
| 60 |
} |
} |
| 61 |
|
|
| 96 |
} |
} |
| 97 |
|
|
| 98 |
$argfile = $ARGV[0] or die "Invalid number of arguments"; |
$argfile = $ARGV[0] or die "Invalid number of arguments"; |
| 99 |
$arglang = $ARGV[1] or die "Invalid number of arguments"; |
die "Invalid number of arguments" unless $ARGV[1]; |
| 100 |
|
$arglang = $langs{$ARGV[1]} or die "Invalid lang argument: $ARGV[1]"; |
| 101 |
$argfile =~ m+(.*)/(.*)\.wml+ or die "pattern does not match"; |
$argfile =~ m+(.*)/(.*)\.wml+ or die "pattern does not match"; |
| 102 |
my ($path, $file) = ($1, $2); |
my ($path, $file) = ($1, $2); |
| 103 |
|
|
| 116 |
my $transfile = $argfile; |
my $transfile = $argfile; |
| 117 |
my ($maxdelta, $mindelta) = (5, 2); |
my ($maxdelta, $mindelta) = (5, 2); |
| 118 |
my ($original, $langrev); |
my ($original, $langrev); |
| 119 |
print "Now checking $lang\n"; |
print "Now checking $lang\n" if $debug; |
| 120 |
$transfile =~ s+$arglang+$lang+ or die "wrong argument: pattern does not match file: $transfile"; |
$transfile =~ s+$arglang+$lang+ or die "wrong argument: pattern does not match file: $transfile"; |
| 121 |
|
|
| 122 |
# Parse the translated file |
# Parse the translated file |