[Po4a-commits] "po4a NEWS, 1.69, 1.70 changelog, 1.404, 1.405 po4a, 1.82, 1.83"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Mon Dec 29 13:16:41 UTC 2008
Update of /cvsroot/po4a/po4a
In directory alioth:/tmp/cvs-serv22162
Modified Files:
NEWS changelog po4a
Log Message:
* Added support for the [po_directory] command in the configuration file.
It permits to avoid listing the supported languages. Simply dropping a
new PO file should be sufficient. It should be preferred over the
po4a_langs and po4a_paths commands.
Index: NEWS
===================================================================
RCS file: /cvsroot/po4a/po4a/NEWS,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- NEWS 6 Dec 2008 16:09:48 -0000 1.69
+++ NEWS 29 Dec 2008 13:16:39 -0000 1.70
@@ -3,6 +3,11 @@
===============================================================================
* Major changes in release 0.35 (UNRELEASED)
+po4a
+ * Added support for the [po_directory] command in the configuration file.
+ It permits to avoid listing the supported languages. Simply dropping a
+ new PO file should be sufficient. It should be preferred over the
+ po4a_langs and po4a_paths commands.
po4a-normalize:
* Added option -b, --blank to check which parts of a document are not
translated.
Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- po4a 1 Jun 2008 16:16:33 -0000 1.82
+++ po4a 29 Dec 2008 13:16:39 -0000 1.83
@@ -94,6 +94,22 @@
[po4a_paths] doc/$master/$master.pot $lang:doc/$master/$lang.po
+=head2 Autodetection of the paths and languages
+
+Another command can be used to specify the name of a directory where the
+PO and POT files are located.
+When it is used, po4a will detect the POT file as the only "*.pot" file
+from the specified directory.
+Po4a will also use the list of "*.po" files to define the list of
+languages (by stripping out the extension).
+These languages will be used for the substitution of the $lang variable in
+the rest of the configuration file.
+
+This command should not be used together with the po4a_langs or po4a_paths
+commands.
+
+ [po_directory] po4a/po/
+
=head2 Specifying the documents to translate
You now naturally have to specify which documents are translated, their
@@ -640,6 +656,44 @@
if (@langs);
@langs = split(/ /,$main." ".$args);
+ } elsif ($cmd eq "po_directory") {
+ die wrap_ref_mod("$config_file:$nb", "",
+ gettext("The list of languages cannot be set twice."))
+ if scalar @langs;
+ die wrap_ref_mod("$config_file:$nb", "",
+ gettext("The POT file cannot be set twice."))
+ if length $pot_filename;
+
+ my $po_directory = $main;
+ die wrap_ref_mod("$config_file:$nb", "",
+ gettext("'%s' is not a directory"), $po_directory)
+ unless (-d $po_directory);
+ opendir PO_DIR, $po_directory
+ or die wrap_ref_mod("$config_file:$nb", "",
+ gettext("Cannot list the '%s' directory"), $po_directory);
+
+ foreach my $f (readdir PO_DIR) {
+ next unless -f "$po_directory/$f";
+ if ($f =~ m/^(.*)\.po$/) {
+ push @langs, $1;
+ $po_filename{$1} = "$po_directory/$f";
+ }
+ if ($f =~ m/\.pot$/) {
+ if (length $pot_filename) {
+ die wrap_ref_mod("$config_file:$nb", "",
+ gettext("too many POT files: %s %s"),
+ $pot_filename, "$po_directory/$f");
+ } else {
+ $pot_filename = "$po_directory/$f";
+ }
+ }
+ }
+
+ if (not @langs) {
+ warn wrap_ref_mod("$config_file:$nb", "",
+ gettext("no PO files found in %s"), $po_directory);
+ }
+
} elsif ($cmd =~ m/type: *(.*)/) {
if (defined $document{$main}{'format'}) {
warn wrap_ref_mod("$config_file:$nb", "",
Index: changelog
===================================================================
RCS file: /cvsroot/po4a/po4a/changelog,v
retrieving revision 1.404
retrieving revision 1.405
diff -u -d -r1.404 -r1.405
--- changelog 29 Dec 2008 12:51:38 -0000 1.404
+++ changelog 29 Dec 2008 13:16:39 -0000 1.405
@@ -1,5 +1,9 @@
2008-12-29 Nicolas François <nicolas.francois at centraliens.net>
+ * NEWS, po4a: Added [po_directory] command to the config file.
+
+2008-12-29 Nicolas François <nicolas.francois at centraliens.net>
+
* lib/Locale/Po4a/Docbook.pm: Reworked to take into account all
the DocBook 5.0 tags, with the new classification.
More information about the Po4a-commits
mailing list