On Thu, May 26, 2005 at 07:32:10PM +0200, Francois Gouget wrote:
Martin Quinson wrote:
[...]
>>There's one thing that Xml.pm supports that this does not support:
>>Xml.pm lets you specify that an attribute must only be translated if it
>>is found in a specific tag list:
>>
>> You can specify the attributes by their name (for example, "lang"),
>> but you can prefix it with a tag hierarchy, to specify that this
>> attribute will only be translated when it's into the specified tag.
>> For example: <bbb><aaa>lang specifies that the lang attribute will
>> only be translated if it's into an <aaa> tag, and it's into a
<bbb>
>> tag.
>>
>>I think this functionality can be added later if needed. For now it
>>seems mostly overkill to me.
>
>Well. That may be an issue. In html, some attibutes need to be translated
>when in a specific tag and not in others. I think we don't need to keep the
>whole stack, but the embeeding tag seem important to me.
But does the Sgml module actually support Html? I did not see it in the
'$prolog' switch. Which attributes need to be translated in Html?
Not yet, actually. But it could/should. The main blocker was the need to
translate a bunch of attributes. Now that it's possible, it opens the way to
a proper html support in po4a (note that xhtml is already supported by
xml.pm, if I remember well).
The "value" attribute of <submit> have to be translated since it's
the
button label. But it shouldn't be translated elsewhere as in radio buttons
(I can't remember the tag name right now). It would even be *bad* to
translate them in there since it would break CGI scripts and such.
[...]
>>+ foreach (split(/ /, ($self->{SGML}->{k}{'attribute'}) ||
'')) {
>>+ $attribute{uc $_} = 1;
>>+ }
[...]
>Maybe change $attribute{uc $_} to an array of embeeding tags?
Or rather a hashtable so we can do check on the embedding tag name like
this:
if ($attribute{$attr}->{""} or
$attribute{$attr}->{$event->data->name()})
With {""} catching the case where we we translate the attribute for all
tags.
Hmm, I have just realised that in DocBook the 'lang' tag is a common
attribute which means it can be put on any tag. This means it would be a
good idea to make it possible to restrict its translation to specific
tag hierarchies :-(
[...]
>># Please translate the lang attribute
>>msgid "<book lang=en>"
>>msgstr "<book lang=fr>"
>
>
>If it's feasible, it'd be even better.
A given tag may have more than one attribute that needs to be translated
and also one or more attributes that don't need to be translated. I'm
not sure it would be a good idea to translate them all together.
Part of the issue in deciding this is to see what other attributes would
need to be translated. For DocBook I can't think of any.
You are right. Let's stick to
>>># Please translate the lang attribute of the book tag
>>msgid "lang=en"
>>msgstr "lang=fr"
, then. I feel concerned about the value (like "en") being used elsewhere,
even if it's quite unprobable given the fact that po4a tries to translate
whole paragraphs. But two tag attributes may need different translations in
some catastrophic settings.
Thanks for your time,
Mt.