[Po4a-commits] "po4a po4a,1.100,1.101"
Denis Barbier
barbier-guest at alioth.debian.org
Sat Apr 17 20:53:35 UTC 2010
- Previous message: [Po4a-commits] "po4a Build.PL, 1.45, 1.46 po4a, 1.99, 1.100 po4a-gettextize, 1.40, 1.41 po4a-normalize, 1.32, 1.33 po4a-translate, 1.44, 1.45 po4a-updatepo, 1.47, 1.48"
- Next message: [Po4a-commits] "po4a changelog,1.551,1.552"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/po4a/po4a
In directory alioth:/tmp/cvs-serv25850
Modified Files:
po4a
Log Message:
Redesign --build-only option and rename it into --translate-only
Locale::Po4a::Po->filter() is currently too slow with large configuration
files. Until this is fixed, --build-only does not update PO and POT files,
this option only translates files. For this reason, it is renamed into
--translate-only.
Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- po4a 17 Apr 2010 09:26:50 -0000 1.100
+++ po4a 17 Apr 2010 20:53:33 -0000 1.101
@@ -386,11 +386,11 @@
Remove the .po~ backup files (implies --no-backups).
-=item --build-only I<translated-file>
+=item --translate-only I<translated-file>
Translate only the specified file. It may be useful to speed up
processing if configuration file contains a lot of files. Note that this
-option reorders entries in PO and POT files, it should be used with care.
+option does not update PO and POT files.
This option can be used multiple times.
=item --variable I<var>=I<value>
@@ -566,7 +566,7 @@
'keep|k=s' => \$opts{"threshold"},
'no-translations' => \$opts{"no-translations"},
'rm-translations' => \$opts{"rm-translations"},
- 'build-only=s' => \@{$opts{"partial"}},
+ 'translate-only=s' => \@{$opts{"partial"}},
'no-backups' => \$opts{"no-backups"},
'rm-backups' => \$opts{"rm-backups"},
'version|V' => \&show_version,
@@ -715,7 +715,7 @@
my (%po_filename); # po_files: '$lang'=>'$path'
my (%document); # '$master'=> {'format'=>'$format'; '$lang'=>'$path'; 'add_$lang'=>('$path','$path') }
my $doc_count = 0;
-my %partial = ( 'skip' => [], 'master' => {}, 'files' => {}, 'lang' => {} );
+my %partial = ( 'master' => {}, 'files' => {}, 'lang' => {} );
open CONFIG,"<","$config_file" or die wrap_msg(gettext("Can't open %s: %s"), $config_file, $!);
my ($line,$nb) = ("",0);
while (<CONFIG>) {
@@ -835,17 +835,14 @@
gettext("The '%s' master file does not exist."), $main);
}
if (scalar @{$po4a_opts{"partial"}}) {
- my $found = 0;
foreach my $file (@{$po4a_opts{"partial"}}) {
if ($args =~ m/(\S+):\Q$file\E\b/) {
$partial{'lang'}{$1} = 1;
$partial{'master'}{$main} = 1;
$partial{'files'}{$file} = 1;
- $found = 1;
last;
}
}
- push (@{$partial{'skip'}}, $main) unless $found;
}
$document{$main}{'format'} = $1;
$document{$main}{'pos'} = $doc_count;
@@ -1004,7 +1001,7 @@
print wrap_msg(gettext("Split mode, creating a temporary POT")."\n")
if $po4a_opts{"verbose"};
if (scalar @{$po4a_opts{"partial"}}) {
- print wrap_msg(gettext("Disabling --build-only option, it is not supported in split mode")."\n");
+ print wrap_msg(gettext("Disabling --translate-only option, it is not supported in split mode")."\n");
$po4a_opts{"partial"} = [];
}
foreach my $master (keys %document) {
@@ -1024,12 +1021,13 @@
next unless length $master;
delete $document{$master} unless exists $partial{'master'}{$master};
}
- # Do not touch PO files if no file is processed for this language
+ # Do not read PO files if no file is processed for this language
foreach my $lang (keys %po_filename) {
delete $po_filename{$lang} unless exists $partial{'lang'}{$lang};
}
}
+if (not scalar @{$po4a_opts{"partial"}}) {
chdir $po4a_opts{"srcdir"}
if (defined $po4a_opts{"srcdir"});
if (-e $pot_filename) {
@@ -1066,6 +1064,7 @@
chdir $po4a_opts{"calldir"}
if (defined $po4a_opts{"srcdir"});
}
+}
my %Po_opts;
if (defined $po4a_opts{'msgid-bugs-address'}) {
@@ -1080,24 +1079,12 @@
if (defined $po4a_opts{'package-version'}) {
$Po_opts{'package-version'} = $po4a_opts{'package-version'};
}
-chdir $po4a_opts{"srcdir"}
- if (defined $po4a_opts{"srcdir"});
-my $potfile=Locale::Po4a::Po->new(\%Po_opts);
-if (scalar @{$po4a_opts{"partial"}} and -e $pot_filename) {
- print wrap_msg(gettext("Partial update, reading %s first")." ", $pot_filename)
- if ($po4a_opts{"verbose"});
- $potfile->read($pot_filename);
- $potfile = $potfile->filter("(reference=\"(^| )(".join("|", @{$partial{'skip'}})."):\")");
- # FIXME: We have to modify $potfile internals to remove references, there
- # should be a $potfile->remove_references($foo) method instead.
- my $re = "(".join('|', keys %{$partial{'master'}})."):\\d+\\s*";
- foreach my $msgid (keys %{$potfile->{po}}) {
- $potfile->{po}{$msgid}{'reference'} =~ s/$re//go;
- }
-}
-chdir $po4a_opts{"calldir"}
- if (defined $po4a_opts{"srcdir"});
if ($update_pot_file) {
+ chdir $po4a_opts{"srcdir"}
+ if (defined $po4a_opts{"srcdir"});
+ my $potfile=Locale::Po4a::Po->new(\%Po_opts);
+ chdir $po4a_opts{"calldir"}
+ if (defined $po4a_opts{"srcdir"});
foreach my $master (sort { return -1 if ($a eq "");
return 1 if ($b eq "");
$document{$a}{'pos'} <=> $document{$b}{'pos'}
@@ -1150,12 +1137,6 @@
print wrap_msg(gettext(" (%d entries)"), $potfile->count_entries())
unless ($po4a_opts{"quiet"});
-} else {
- chdir $po4a_opts{"srcdir"}
- if (defined $po4a_opts{"srcdir"});
- $potfile->read($pot_filename);
- chdir $po4a_opts{"calldir"}
- if (defined $po4a_opts{"srcdir"});
}
if ($po4a_opts{"split"}) {
@@ -1226,6 +1207,7 @@
# update all po files
my $lang;
+if (not scalar @{$po4a_opts{"partial"}}) {
foreach $lang (sort keys %po_filename) {
chdir $po4a_opts{"srcdir"}
if (defined $po4a_opts{"srcdir"});
@@ -1249,6 +1231,7 @@
chdir $po4a_opts{"calldir"}
if (defined $po4a_opts{"srcdir"});
}
+}
if ($po4a_opts{"split"}) {
chdir $po4a_opts{"srcdir"}
- Previous message: [Po4a-commits] "po4a Build.PL, 1.45, 1.46 po4a, 1.99, 1.100 po4a-gettextize, 1.40, 1.41 po4a-normalize, 1.32, 1.33 po4a-translate, 1.44, 1.45 po4a-updatepo, 1.47, 1.48"
- Next message: [Po4a-commits] "po4a changelog,1.551,1.552"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Po4a-commits
mailing list