Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv8837
Modified Files:
po4a
Log Message:
Add a -k option to po4a; polish some more messages
Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- po4a 18 Jul 2004 06:12:01 -0000 1.5
+++ po4a 18 Jul 2004 06:27:25 -0000 1.6
@@ -82,6 +82,12 @@
=over 4
+=item -k, --keep
+
+Minimal threshold for translation percentage to keep (ie, write) the
+resulting file (default: 80). Ie, by default, files have to be translated
+at at least 80% to get written.
+
=item -h, --help
Show a short help message.
@@ -175,12 +181,14 @@
my ($help,$type,$debug,$verbose,$quiet,@options);
$verbose = 0;
$debug = 0;
+my ($threshold)=(80);
Getopt::Long::config('bundling', 'no_getopt_compat',
'no_auto_abbrev');
GetOptions(
'help|h' => \$help,
'verbose|v' => \$verbose,
'debug|d' => \$debug,
'quiet|q' => \$quiet,
+ 'keep|k=s' => \$threshold,
'version|V' => \&show_version
) or pod2usage(1);
@@ -297,7 +305,7 @@
my $lang;
foreach $lang (sort keys %po_filename) {
if (-e $po_filename{$lang}) {
- print STDERR sprintf(gettext("Updating
%s:")."\n",$po_filename{$lang})
+ print STDERR sprintf(gettext("Updating %s: "),$po_filename{$lang})
if $verbose;
system ("msgmerge","-U",$po_filename{$lang},$pot_filename) == 0 ||
die sprintf(gettext("Error while running msgmerge:
%s"),$!)."\n";
@@ -328,9 +336,9 @@
my ($percent,$hit,$queries) = $doc->stats();
- if ($percent<80) {
- print STDERR sprintf(gettext("Translation of %s discarded: only %s%% are
translated."),
- $master,$percent)."\n";
+ if ($percent<$threshold) {
+ print STDERR sprintf(gettext("Discard the translation of %s (only %s%%
translated; need %s%%)."),
+ $master,$percent,$threshold)."\n";
unlink($document{$master}{$lang}) if (-e $document{$master}{$lang});
next LANG;
}
@@ -345,6 +353,10 @@
}
}
}
+ print STDERR sprintf(gettext("%s is %s%% translated (%s of %s strings)."),
+ $master,$percent,$hit,$queries)."\n"
+ if $verbose;
+
$doc->write($document{$master}{$lang});
}
}