[Po4a-commits] "po4a po4a-gettextize,1.34,1.35"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sun Nov 13 12:29:22 UTC 2005


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv17894

Modified Files:
	po4a-gettextize 
Log Message:
support for multiple master/localized files.


Index: po4a-gettextize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-gettextize,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- po4a-gettextize	22 Sep 2005 21:51:49 -0000	1.34
+++ po4a-gettextize	13 Nov 2005 12:29:20 -0000	1.35
@@ -151,15 +151,15 @@
 }
 
 my ($pofile)=('-');
-my ($masterfile,$locfile,$help_fmt,$help,$type,$debug,$verbose, at options);
+my (@masterfile, at locfile,$help_fmt,$help,$type,$debug,$verbose, at options);
 my ($mastchar,$locchar);
 Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
 GetOptions(
 	'help|h'        => \$help,
 	'help-format'   => \$help_fmt,
 
-	'master|m=s'    => \$masterfile,
-	'localized|l=s' => \$locfile,
+	'master|m=s'    => \@masterfile,
+	'localized|l=s' => \@locfile,
 	'po|p=s'        => \$pofile,
 	'format|f=s'    => \$type,
 
@@ -176,8 +176,7 @@
 # Argument check
 $help && pod2usage (-verbose => 1, -exitval => 0);
 $help_fmt && Locale::Po4a::Chooser::list(0);
-pod2usage () if (scalar @ARGV > 1) || 
-    (!defined($masterfile)) || (!length($masterfile));
+pod2usage () if (scalar @ARGV > 1) || (scalar @masterfile < 1);
 
 my %options = (
     "verbose" => $verbose,
@@ -191,9 +190,8 @@
     }
 }
 # Check file existence
--e $masterfile || die wrap_msg(gettext("File %s does not exist."), $masterfile);
-if (defined $locfile && length($locfile)) {
-    -e $locfile || die wrap_msg(gettext("File %s does not exist."), $locfile);
+foreach my $file (@masterfile, @locfile) {
+    -e $file || die wrap_msg(gettext("File %s does not exist."), $file);
 }
 
 # Declare the TransTractor parsers
@@ -201,19 +199,23 @@
 			 Locale::Po4a::Chooser::new($type,%options));
 
 # Parse master file forcing conversion to utf if it's not in ascii
-$mastertt->read($masterfile);
+foreach my $file (@masterfile) {
+  $mastertt->read($file);
+}
 $mastertt->{TT}{utf_mode} = 1;
 $mastertt->{TT}{file_in_charset} = $mastchar;
 $mastertt->parse;
 
 
-unless (defined ($locfile) && length($locfile)) {
+unless (scalar @locfile >= 1) {
   # Ok, outputing the pot extracted from original is enough
   $mastertt->writepo($pofile);
 } else {
   # We have to merge two transtractor files
 
-  $transtt->read($locfile);
+  foreach my $file (@locfile) {
+    $transtt->read($file);
+  }
   # We force the conversion to utf if the master document wasn't in ascii
   $transtt->{TT}{utf_mode} = !$mastertt->{TT}{ascii_input};
   $transtt->{TT}{file_in_charset} = $locchar;




More information about the Po4a-commits mailing list