[Po4a-devel]Sgml module does not translate the lang attribute

Francois Gouget fgouget@free.fr
Thu, 19 May 2005 11:59:52 +0200 (CEST)


I am putting po4a in place for the translation of the Wine 
documentation. Pretty much the only issue is that the text generated by 
DocBook itself, 'Table of Contents' for instance, is not translated. The 
reason is that the language to use for this text is defined by the 
'lang' attribute as in:

<book lang="en">
...
</book>

But the value of the lang attribute is passed as is by po4a-translate. I 
checked the Sgml.pm module and indeed it does not have any provision for 
translating attributes :-(

It looks like it should be done near this code (line 680):

                 if ($val->type() eq 'CDATA' ||
 		    $val->type() eq 'IMPLIED') {
 		    if (defined $value && length($value)) {
 			if ($value =~ m/"/) { #"
 			    $value = "'".$value."'";
 			} else {
 			    $value = '"'.$value.'"';
 			}
 			$tag .= ' '.lc($attr).'='.$value;
 		    }

Unfortunately that's as far as I got and now I don't have any idea on 
how to modify this code to add this functionality. Maybe if someone can 
provide me some pointers...

-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
May your Tongue stick to the Roof of your Mouth with the Force of a Thousand Caramels.