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?
[...]
>+ 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 :-(
[...]
>Maybe the documentation has an 'en' that needs to be
translated
>differently somewhere else.
That's more problematic.
>If it is felt that this is an issue it would be pretty easy to modify the
>patch so that the msgid reads as follows:
>
>msgid "lang=en"
>msgstr "lang=fr"
Well. Why not? We could then translate the whole tag, something like:
># 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.
I didn't commit it yet. I prefer to discuss it a bit further, if
you don't
mind.
No problem.
--
Francois Gouget
fgouget(a)codeweavers.com