W3C home > Mailing lists > Public > www-style@w3.org > June 2014

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

From: Liam R E Quin <liam@w3.org>
Date: Tue, 17 Jun 2014 17:14:22 -0400
Message-ID: <1403039662.27292.84.camel@slave.barefootcomputing.com>
To: Christoph Päper <christoph.paeper@crissov.de>
Cc: www-style list <www-style@w3.org>
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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:22 UTC