[Po4a-devel] Translatable attributes in HTML

Nicolas François nicolas.francois at centraliens.net
Sun Aug 5 17:00:35 UTC 2007


Hello,


On Sun, Aug 05, 2007 at 02:31:11AM +0300, Kaloian Doganov wrote:
> Recently I've started to play with po4a while trying to
> internationalize a bunch of articles in HTML format.  One of the major
> obstacles for making the job done is this: po4a considers as
> translatable (almost) only the text contained between the tags of an
> element.  This is OK, but sometimes is not enough, since in HTML some
> attributes are intended to contain a human-readable text.  For
> example:
> 
>    <link rel="stylesheet" type="text/css" href="/new.css" title= "All-new style of mine">
> 
>    <a href="/" accesskey="1" title="Go to the project homepage">
> 
> The value of the `title' attribute here should be translatable too.
> 
> In fact, HTML.pm already does this by treating the IMG's `alt'
> attribute specially and thus making it's value translatable.  Maybe
> IMG's `alt' is the most common case for an attribute that needs
> translation, but there are three other elements that also can contain
> `alt': INPUT, AREA and APPLET.  They deserve the same treatment as
> IMG.
> 
> Also, it would be nice if `title' attribute is considered translatable
> too (keeping in mind that any element can contain a `title'
> attribute).
> 
> A patch that solves those two problems is attached.

Thanks a lot for your patch.

It is now applied in the po4a's repository.

Note also that you may want to try the xhtml module. It may provide a
better result (even if it's for regular HTML and not XHTML).

Best Regards,
-- 
Nekral



More information about the Po4a-devel mailing list