| 20 |
# - compare both major and minor revision number |
# - compare both major and minor revision number |
| 21 |
# - think of a better way to check when the file has been rebuilt last |
# - think of a better way to check when the file has been rebuilt last |
| 22 |
|
|
| 23 |
|
# These modules reside under webwml/Perl |
| 24 |
# This should contain all languages |
use lib ($0 =~ m|(.*)/|, $1 or ".") ."/Perl"; |
| 25 |
%langs = ( |
use Local::Cvsinfo; |
| 26 |
"ar" => "arabic", |
use Webwml::Langs; |
| 27 |
"zh" => "chinese", |
use Webwml::TransCheck; |
|
"hr" => "croatian", |
|
|
"da" => "danish", |
|
|
"nl" => "dutch", |
|
|
"el" => "hellas", |
|
|
"en" => "english", |
|
|
"eo" => "esperanto", |
|
|
"fi" => "finnish", |
|
|
"fr" => "french", |
|
|
"de" => "german", |
|
|
"hu" => "hungarian", |
|
|
"it" => "italian", |
|
|
"ja" => "japanese", |
|
|
"ko" => "korean", |
|
|
"no" => "norwegian", |
|
|
"pl" => "polish", |
|
|
"pt" => "portuguese", |
|
|
"ro" => "romanian", |
|
|
"ru" => "russian", |
|
|
"es" => "spanish", |
|
|
"sv" => "swedish", |
|
|
"tr" => "turkish"); |
|
|
|
|
|
@langs = values(%langs); |
|
| 28 |
|
|
| 29 |
# Set this to 1 for debugging |
# Set this to 1 for debugging |
| 30 |
$debug = 0; |
$debug = 0; |
| 72 |
} |
} |
| 73 |
} |
} |
| 74 |
|
|
| 75 |
|
# We call constructor without argument. It means there must be a |
| 76 |
|
# CVS/Repository file or program will abort. |
| 77 |
|
my $l = Webwml::Langs->new(); |
| 78 |
|
my %langs = $l->iso_name(); |
| 79 |
|
my @langs = $l->names(); |
| 80 |
|
|
| 81 |
$argfile = $ARGV[0] or die "Invalid number of arguments"; |
$argfile = $ARGV[0] or die "Invalid number of arguments"; |
| 82 |
die "Invalid number of arguments" unless $ARGV[1]; |
die "Invalid number of arguments" unless $ARGV[1]; |
| 83 |
$arglang = $langs{$ARGV[1]} or die "Invalid lang argument: $ARGV[1]"; |
$arglang = $langs{$ARGV[1]} or die "Invalid lang argument: $ARGV[1]"; |
| 84 |
$argfile =~ m+(.*)/(.*)\.wml+ or die "pattern does not match"; |
$argfile =~ m+(.*)/(.*\.wml)+ or die "pattern does not match"; |
| 85 |
my ($path, $file) = ($1, $2); |
my ($path, $file) = ($1, $2); |
| 86 |
|
|
| 87 |
# Get the revision of the original file |
my $cvs = Local::Cvsinfo->new(); |
| 88 |
my $origrev; |
$cvs->options(matchfile => [ $file ]); |
| 89 |
open FILE, "${path}/CVS/Entries" or die "${path}/CVS/Entries: $!"; |
$cvs->readinfo($path); |
| 90 |
while (<FILE>) { |
my $origrev = $cvs->revision($argfile) || "1.0"; |
|
if (m,^/$file.wml/([^/]+)/,) { |
|
|
$origrev = $1; |
|
|
last; |
|
|
} |
|
|
} |
|
| 91 |
|
|
| 92 |
foreach $lang (@langs) { |
foreach $lang (@langs) { |
| 93 |
next if ($lang eq $arglang); |
next if ($lang eq $arglang); |
| 98 |
$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"; |
| 99 |
|
|
| 100 |
# Parse the translated file |
# Parse the translated file |
| 101 |
open FILE, "$transfile" or next; |
my $transcheck = Webwml::TransCheck->new($transfile); |
| 102 |
while (<FILE>) { |
next unless $transcheck->revision(); |
| 103 |
if (/translation-check translation="([.0-9]*)"\s*(.*)/oi) { |
$langrev = $transcheck->revision(); |
| 104 |
$langrev = $1; |
$original = $transcheck->original(); |
| 105 |
my $stuff = $2; |
$maxdelta = $transcheck->maxdelta() if $transcheck->maxdelta(); |
| 106 |
if ($stuff =~ /original="([^"]+)"/) { |
$mindelta = $transcheck->mindelta() if $transcheck->mindelta(); |
|
$original = $1; |
|
|
} |
|
|
if ($stuff =~ /maxdelta="([^"]+)"/) { |
|
|
$maxdelta = $1; |
|
|
} |
|
|
if ($stuff =~ /mindelta="([^"]+)"/) { |
|
|
$mindelta = $1; |
|
|
} |
|
|
last; |
|
|
} |
|
|
} |
|
|
close FILE; |
|
|
next if not defined $langrev; |
|
| 107 |
# TODO - would cause unspecified results if 1. changed to 2. |
# TODO - would cause unspecified results if 1. changed to 2. |
| 108 |
$origrev =~ s/1\.//; |
$origrev =~ s/1\.//; |
| 109 |
$langrev =~ s/1\.//; |
$langrev =~ s/1\.//; |