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

Martin Quinson martin.quinson@loria.fr
Sat, 28 May 2005 21:15:23 +0200


--FsscpQKzF/jJk6ya
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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:=20
> >>Xml.pm lets you specify that an attribute must only be translated if it=
=20
> >>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=20
> >>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.
>=20
> But does the Sgml module actually support Html? I did not see it in the=
=20
> '$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 $_} =3D 1;
> >>+    }
> [...]
> >Maybe change $attribute{uc $_} to an array of embeeding tags?
>=20
> Or rather a hashtable so we can do check on the embedding tag name like=
=20
> this:
>   if ($attribute{$attr}->{""} or $attribute{$attr}->{$event->data->name()=
})
>=20
> With {""} catching the case where we we translate the attribute for all=
=20
> tags.
>=20
> Hmm, I have just realised that in DocBook the 'lang' tag is a common=20
> attribute which means it can be put on any tag. This means it would be a=
=20
> good idea to make it possible to restrict its translation to specific=20
> tag hierarchies :-(
>=20
>=20
[...]

> >># Please translate the lang attribute
> >>msgid "<book lang=3Den>"
> >>msgstr "<book lang=3Dfr>"
> >
> >
> >If it's feasible, it'd be even better.=20
>=20
> A given tag may have more than one attribute that needs to be translated=
=20
> and also one or more attributes that don't need to be translated. I'm=20
> 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=
=20
> need to be translated. For DocBook I can't think of any.

You are right. Let's stick to=20

> >>># Please translate the lang attribute of the book tag
> >>msgid "lang=3Den"
> >>msgstr "lang=3Dfr"

, 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,=20
Mt.

--FsscpQKzF/jJk6ya
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)

iD8DBQFCmMNLIiC/MeFF8zQRAmJ6AKDF3+JgLiSy+m8B0RM3jeicA1ZXhACfYG3W
ZWkZet2Vu9gGLIq64kPYts0=
=+VVS
-----END PGP SIGNATURE-----

--FsscpQKzF/jJk6ya--