[Po4a-devel][PATCH] Stats of empty files

Jordi Vilalta jvprat@wanadoo.es
Sat, 4 Dec 2004 16:12:36 +0100 (CET)


Hi,

On Sat, 4 Dec 2004, Yves Rutschle wrote:

> Hi all,
>
> If a file has no msgids in it, po4a decides to set its "completed" stat to 0.
> But if there are no msgids, then the file really is 100% translated:
>
> diff -u -r1.30 Po.pm
> --- lib/Locale/Po4a/Po.pm       27 Nov 2004 01:08:56 -0000      1.30
> +++ lib/Locale/Po4a/Po.pm       4 Dec 2004 13:40:56 -0000
> @@ -689,7 +689,7 @@
> sub stats_get() {
>     my $self=shift;
>     my ($h,$q)=($self->{gettexthits},$self->{gettextqueries});
> -    my $p = ($q == 0 ? 0 : int($h/$q*10000)/100);
> +    my $p = ($q == 0 ? 100 : int($h/$q*10000)/100);
>
> #    $p =~ s/\.00//;
> #    $p =~ s/(\..)0/$1/;
>
>
> (Yes, I have a couple of files that need to go through the translation process
> for consistency's sake, yet have no content to speak of)

This patches the function that generates statistics about the hit ratio of 
the gettext usage, instead of the translation completion status. If it 
isn't used, I think it's right to leave it to 0.

Regards,

Jordi Vilalta