[Po4a-commits] r2687 - /trunk/po4a

barbier at users.alioth.debian.org barbier at users.alioth.debian.org
Sat Oct 27 23:12:19 UTC 2012


Author: barbier
Date: Sat Oct 27 23:12:19 2012
New Revision: 2687

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2687
Log:
Allowing specifying the name of master files in splitted mode

Thanks to Yann Dirson for the report and patch.  A slightly
different version of his patch is implement, syntax is
  master:file=<file-name>

Modified:
    trunk/po4a

Modified: trunk/po4a
URL: http://svn.debian.org/wsvn/po4a/trunk/po4a?rev=2687&op=diff
==============================================================================
--- trunk/po4a (original)
+++ trunk/po4a Sat Oct 27 23:12:19 2012
@@ -278,6 +278,15 @@
 which contain this string. Then, when a translator updates the translation
 and removes the fuzzy tag in one PO, the translation of this string will
 be updated in every POs automatically.
+
+If there are name conflicts because several files have the same filename,
+the name of the master file can be specified by adding a C<master:file=>I<name>
+option:
+
+ [po4a_langs] de fr ja
+ [po4a_paths] l10n/po/$master.pot $lang:l10n/po/$master.$lang.po
+ [type: xml] foo/gui.xml $lang:foo/gui.$lang.xml master:file=foo-gui
+ [type: xml] bar/gui.xml $lang:bar/gui.$lang.xml master:file=bar-gui
 
 =head1 OPTIONS
 
@@ -960,7 +969,12 @@
 	%options = %{$document{$main}{'options'}}
 	  if defined $document{$main}{'options'};
 
-	# 4. Merge the document specific options
+	# 4. Handle "master:file=" flags for "$master" substitution in strings
+	if ($args =~ s/ +master:file=(\S+)//) {
+	    $document{$main}{'master'} = $1;
+	}
+
+	# 5. Merge the document specific options
 	# separate the end of the line, which contains options.
 	# Something more clever could be done to allow options in the
 	# middle of a line.
@@ -1105,7 +1119,7 @@
     }
     foreach my $master (keys %document) {
         next if ($master eq '');
-        my $m = basename $master;
+        my $m = $document{$master}{"master"} || basename $master;
         my $master_pot = $pot_filename;
         $master_pot =~ s/\$master/$m/g;
         $split_pot{$master} = $master_pot;
@@ -1280,7 +1294,7 @@
         my $cmd_cat = "";
         foreach my $master (keys %document) {
             next if ($master eq '');
-            my $m = basename $master;
+            my $m = $document{$master}{"master"} || basename $master;
             my $master_po = $po_filename{$lang};
             $master_po =~ s/\$master/$m/g;
             if (-e "$master_po") {




More information about the Po4a-commits mailing list