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

Martin Quinson martin.quinson@loria.fr
Thu, 26 May 2005 09:34:32 +0200


--XOIedfhf+7KOe/yw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 19, 2005 at 11:59:52AM +0200, Francois Gouget wrote:
>=20
> I am putting po4a in place for the translation of the Wine=20
> documentation. Pretty much the only issue is that the text generated by=
=20
> DocBook itself, 'Table of Contents' for instance, is not translated. The=
=20
> reason is that the language to use for this text is defined by the=20
> 'lang' attribute as in:
>=20
> <book lang=3D"en">
> ...
> </book>
>=20
> But the value of the lang attribute is passed as is by po4a-translate. I=
=20
> checked the Sgml.pm module and indeed it does not have any provision for=
=20
> translating attributes :-(
>=20
> It looks like it should be done near this code (line 680):
>=20
>                 if ($val->type() eq 'CDATA' ||
> 		    $val->type() eq 'IMPLIED') {
> 		    if (defined $value && length($value)) {
> 			if ($value =3D~ m/"/) { #"
> 			    $value =3D "'".$value."'";
> 			} else {
> 			    $value =3D '"'.$value.'"';
> 			}
> 			$tag .=3D ' '.lc($attr).'=3D'.$value;

Yes, that would be here. Something like:

if (lc($attr) eq "lang") {
  $tag .=3D ' '.lc($attr).'=3D'.$NEWLANG;
} else {=20
  $tag .=3D ' '.lc($attr).'=3D'.$value;
}

Not necessary really clean and robust, but working, I *guess*. But do you
know where we can get NEWLANG from? I don't remember of having this
information explecitely anywhere in po4a. we use to use this info as
rootname for the po files, but nothing enforces this until now. Maybe a new
module option?

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

Bye, Mt.

--XOIedfhf+7KOe/yw
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFClXwIIiC/MeFF8zQRAl91AJ4uUaCrg6DdEMyje0Pq7MVCMdBraQCeKHEJ
OrL5sImy3Ep78Zvsx66v2RA=
=AB7I
-----END PGP SIGNATURE-----

--XOIedfhf+7KOe/yw--