Re: [css-variables][i18n] :lang() Example

On Tue, 2014-06-17 at 13:44 +0200, Christoph Päper wrote:
> I believe the spec of the Custom Properties for Cascading Variables
> module would benefit from an example that showed how to use variables
> for internationalization, e.g.
> 
>   :root, /* default */
>   :root:lang(en) {--external-link: "external link";}
>   :root:lang(de) {--external-link: "externer Link";}
> 
>   a[href^="http"]::after {content: " (" var(--external-link) ")"}

I think the Internationalization best practice currently suggests not
putting all languages in the same file; furthermore this approach won't
work if e.g. you have Japanese or Chinese with "ruby" annotations, or if
for some other reason you need markup or formatting in the content.

> Features and values from GCPM etc. are more powerful if used this way.
You can use element() from gcpm with :lang and that may form a better
example, I'm not sure. The two-argument element() isn't widely
implemented, so you end up with extra copies of text in your document,
but this is likely to be better than having document content in CSS,
especially for accessibility.

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

Received on Tuesday, 17 June 2014 21:14:25 UTC