[Po4a-devel] Bug#631874: po4a: [xhtml] Please translate lang attributes.

David Prévot david at tilapin.org
Tue Nov 8 15:47:30 UTC 2011


retitle 631874 po4a: [xml] Please make xml:lang automatically translated
thanks

Hi Charles, the po4a upstream developers list,

[ Please refer to
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631874 for full context ]

Le 02/11/2011 22:40, Charles Plessy a écrit :
> Le Mon, Oct 31, 2011 at 03:20:30PM -0400, David Prévot a écrit :
>>
>> The lang attribute is already automatically translated. In order to
>> translate the xml:lang one, adding the “attributes=xml:lang” option is
>> enough for your purpose, as documented in Locale::Po4a::Xml(3).
>>
>> I don't know if we want to make this attribute automatically (i.e. by
>> default) translated, any opinion about it?

> In the case of the xml:lang, in my (limited) experience, I do not see a
> situation where it would cause me problem to have it translated by default.

I don't know the exact rationale of using xml:lang instead of lang, a
look at some documentation [0] makes me think that the intended use of
xml:lang is to allow the use of several languages in different section
of a same page. (Side note: Charles, in your example, why are you using
the xml:lang attribute instead of the lang one that already exists for
the html tag?)

	0: http://docs.oasis-open.org/dita/v1.1/OS/archspec/xmllang.html

If xml:lang was translated by default, it may cause harm in the
following situation (crappy novice XML inside):

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<p>Some translatable text</p>
	<img alt="Image with boring English untranslated text inside"
		src="boring.png" xml:lang="en"/>
</html>

If both lang and xml:lang are translated, since it's the same string,
they both  will show e.g. fr for a French translation, but the resulting
translated file will be wrong:

<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
	<p>Du texte traduisible</p>
	<img alt="Image contenant avec du texte anglais intraduisible"
		src="boring.png" xml:lang="fr"/>
</html>

Even if the image still ships English text inside, it will be declared
as French content, which is not true.

I guess that making xml:lang translated by default may harm in some
cases, so I won't be in favor of changing the current default behavior,
but someone with more XML experience could enlighten us otherwise, so I
keep the bug open for the moment.

Regards

David


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/po4a-devel/attachments/20111108/820ed341/attachment.pgp>


More information about the Po4a-devel mailing list