Re: various fixes for stattrans.pl
On Mon, Apr 18, 2005 at 11:10:40AM +0200, Thomas Huriaux wrote:
> Hi,
>
> This patch fixes a few things in stattrans.pl:
> * fix a bug when the original no longer exists (the
> elsif ( !$version && $transversion) was never true
> * warn when translation-check version is higher than the original
> file version
> * if both english and $lang files have no translation-check header,
> assume that english is the original (instead of $lang)
>
> Can somebody check this patch and tell me if each change is ok before
> I commit it?
Your changes look fine, I have only minor comments below:
[...]
> $version{"$lang/$file"} = $altcvs->revision($f);
> if (!$transcheck->revision()) {
> - $original{"english/$file"} = $lang;
> - $transversion{"english/$file"} ||= "1.1";
> + $transcheckenglish = Webwml::TransCheck->new("english/$file");
> + if (!$transcheckenglish->revision() and (-e "english/$file")) {
> + $transversion{"$lang/$file"} = "1.1";
> + $original{"$lang/$file"} = "english";
> + } else {
> + $original{"english/$file"} = $lang;
> + $transversion{"english/$file"} ||= "1.1";
> + }
English files are processed first, so there is IMO no need to introduce
$transcheckenglish, you can instead try (not tested)
if (-e "english/$file" && !defined($transversion{"english/$file"})) {
$transversion{"$lang/$file"} = "1.1";
$original{"$lang/$file"} = "english";
} else {
$original{"english/$file"} = $lang;
$transversion{"english/$file"} ||= "1.1";
}
With both versions (yours and mine), $original{"english/$file"} is set if
english/$file does not exist, I do not know whether this causes trouble.
Denis
Reply to: