Michael Bauer writes:
> I agree that stating the exact % is not workable unless it can be
> automated. Where did the stats come from that we got by email a few
> weeks back? Were they done manually?
(Not sure what this is in response to, but...)
The stats that look like this:
es: 99.0%: 6223 translated, 65 fuzzy.
da: 95.0%: 5976 translated, 182 fuzzy, 130 untranslated.
fi: 84%: 5313 translated, 706 fuzzy, 269 untranslated.
are generated by a script I quickly hacked together a few weeks ago
which I've hitherto been too embarrassed to admit to, seeing as it's a
Perl wrapper for a Ruby wrapper for gettext. I hope to rewrite it using
one fewer scripting language, but in case I unaccountably fail to get
round to that (or someone else wants a go first), attached is the
current version. Usage: from "po" directory, after "make update-po":
ruby ./statistics.rb | /path/to/po-stats.pl
or for a single translation:
msgfmt --stat kw.po -o /dev/null 2>&1 | /path/to/po-stats.pl
(I have a vague notion that it would be nice if things like the Windows
installer could include these percentage-complete figures for
localisations; if a user is deciding whether to bother installing a
localisation for their language, it probably makes a difference whether
it's 95% or 45% complete; I've started adding percentages to release
notes on Wiki for this reason. However, that requires extra smarts in
the Windows build process, which isn't something I can directly
influence. It would probably be easiest if something like this script
were run as part of making the source tarball and dropped out a stats
file for the installer builder to pick up.)
#! /usr/bin/perl -w -n
# Munges output of "msgfmt --stat" or Freeciv's statistics.rb
sub zerofy($) {
my ($arg) = @_;
return (defined($arg) ? $arg: 0);
}
chomp;
my ($lang, $trans, $fuzzy, $untrans) =
m/^(?:([^:]*): )?(?:(\d+) translated messages?)?(?:, )?(?:(\d+) fuzzy translations?)?(?:, )?(?:(\d+) untranslated messages?)?\.$/;
my $percent = 100.0 *
zerofy($trans) / (zerofy($trans) + zerofy($fuzzy) + zerofy($untrans));
my @strs = ();
push @strs, "$trans translated" if defined($trans);
push @strs, "$fuzzy fuzzy" if defined($fuzzy);
push @strs, "$untrans untranslated" if defined($untrans);
print "$lang: " if defined($lang);
if ($percent == 100 || $percent == 0) {
printf "%.0f%%", $percent;
} elsif ($percent > 95 || $percent < 5) {
my $str = sprintf ("%.1f%%", $percent);
if ($str eq "100.0%") {
print ">99.9%";
} elsif ($str eq "0.0%") {
print "<0.1%";
} else {
print $str;
}
} else {
printf "%.0f%%", $percent;
}
print ": ", join(", ", @strs), ".\n";
_______________________________________________
Freeciv-i18n mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-i18n