[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.32,1.33"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sun Nov 27 21:59:09 UTC 2005


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv13253/lib/Locale/Po4a

Modified Files:
	Xml.pm 
Log Message:
First attempt to translate the entities.


Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- Xml.pm	27 Nov 2005 20:42:16 -0000	1.32
+++ Xml.pm	27 Nov 2005 21:59:07 -0000	1.33
@@ -439,7 +439,9 @@
 	}
 	my $i = 0;
 	while ( $i < $#tag ) {
-		if ( $tag[$i] =~ /^(<!ENTITY\s+)(.*)$/is ) {
+		my $t = $tag[$i];
+		my $ref = $tag[$i+1];
+		if ( $t =~ /^(\s*<!ENTITY\s+)(.*)$/is ) {
 			my $part1 = $1;
 			my $part2 = $2;
 			my $includenow = 0;
@@ -459,11 +461,24 @@
 				$part2 = $2;
 				$file = 1;
 			}
+			if ((not $file) and (not $includenow)) {
+			    if ($part2 =~ m/"(.*)"(\s*>\s*)/) {
+				my $comment = "Content of the $name entity";
+				my $text = $1;
+				$part2 = $2;
+				$text = $self->translate($text,
+				                         $ref,
+				                         $comment,
+				                         'wrap'=>1);
+				$t = $part1."\"$text\"$part2";
+			    }
+			}
 #			print $part1."\n";
 #			print $name."\n";
 #			print $part2."\n";
 		}
-		$i++;
+		$tag[$i] = $t;
+		$i += 2;
 	}
 	return $self->join_lines(@tag);
 }
@@ -1177,6 +1192,11 @@
 
 DOCTYPE (ENTITIES)
 
+There is a minimal support for the translation of entities. They are
+translated as a whole, and tags are not taken into account. Multilines
+entities are not supported and entities are always rewrapped during the
+translation.
+
 INCLUDED FILES
 
 MODIFY TAG TYPES FROM INHERITED MODULES




More information about the Po4a-commits mailing list