[Po4a-commits] "po4a/lib/Locale/Po4a Po.pm, 1.96, 1.97 TransTractor.pm, 1.118, 1.119 Xml.pm, 1.109, 1.110"

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Wed Dec 30 21:12:33 UTC 2009


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv8110/lib/Locale/Po4a

Modified Files:
	Po.pm TransTractor.pm Xml.pm 
Log Message:
	* NEWS, po4a, po4a-updatepo: --previous is activated by default.
	* NEWS, po4a, po4a-updatepo: Use --no-previous to support versions
	of gettext earlier than 0.16.
	* lib/Locale/Po4a/Po.pm: Add a lang attribute, based on the PO
	file basename.
	* NEWS, lib/Locale/Po4a/Xml.pm: Add option addlang to force po4a
	to add a lang attribute to some tags.


Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- Po.pm	27 Dec 2009 01:16:03 -0000	1.96
+++ Po.pm	30 Dec 2009 21:12:31 -0000	1.97
@@ -87,6 +87,7 @@
 use warnings;
 
 use Carp qw(croak);
+use File::Basename;
 use File::Path; # mkdir before write
 use File::Copy; # move
 use POSIX qw(strftime floor);
@@ -220,6 +221,10 @@
                           dgettext("po4a",
                                    "Please provide a non-null filename"));
 
+    my $lang = basename($filename);
+    $lang =~ s/\.po$//;
+    $self->{lang} = $lang;
+
     my $fh;
     if ($filename eq '-') {
         $fh=*STDIN;

Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- Xml.pm	27 Dec 2009 01:16:05 -0000	1.109
+++ Xml.pm	30 Dec 2009 21:12:31 -0000	1.110
@@ -324,6 +324,12 @@
 (if defined). If it doesn't, a warning will indicate that the document
 might be of a bad type.
 
+=item B<addlang>
+
+String indicating the path (e.g. E<lt>bbbE<gt>E<lt>aaaE<gt>) of a tag
+where a lang="..." attribute shall be added. The language will be defined
+as the basename of the PO file without any .po extension.
+
 =item B<tags>
 
 Space-separated list of tags you want to translate or skip.  By default,
@@ -487,6 +493,7 @@
 	              'folded_attributes' => \%folded_attributes);
 	@save_holders = (\%holder);
 
+	$self->{options}{'addlang'}=0;
 	$self->{options}{'nostrip'}=0;
 	$self->{options}{'wrap'}=0;
 	$self->{options}{'caseinsensitive'}=0;
@@ -947,6 +954,13 @@
 
 	$name = $self->treat_attributes(@tag);
 
+	if (defined $self->{options}{'addlang'}) {
+		my $struct = $self->get_path();
+		if ($struct eq $self->{options}{'addlang'}) {
+			$name .= ' lang="'.$self->{TT}{po_in}->{lang}.'"';
+		}
+	}
+
 	return $name;
 }
 

Index: TransTractor.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TransTractor.pm,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- TransTractor.pm	27 Dec 2009 03:45:41 -0000	1.118
+++ TransTractor.pm	30 Dec 2009 21:12:31 -0000	1.119
@@ -11,7 +11,7 @@
 
 use subs qw(makespace);
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION="0.37.1";
+$VERSION="0.37.2";
 @ISA = qw(DynaLoader);
 @EXPORT = qw(new process translate 
              read write readpo writepo




More information about the Po4a-commits mailing list