Closed (fixed)
Project:
Internationalization
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2009 at 17:38 UTC
Updated:
14 Dec 2010 at 17:23 UTC
This simple patch attempts to add a class to the tag of every page based on the language in use as the page is rendered. The class name is the language code prefixed by "i18n-", so "i18n-en", "i18n-es", etc. This makes it trivial for themers to tweak the styling of the page depending on the language that is being used.
This idea was originally suggested as a patch for the Zen theme by user craigntammy in a post on the Zen Task Force group on G.d.o.
Unfortunately, this will not work with all themes, because not all themes respect the variable that this patch tweaks in order to achieve this. It looks like Zen and Fusion subthemes will work with no problem, but not Garland/Minelli… ouch!
| Comment | File | Size | Author |
|---|---|---|---|
| lang-class-to-body.patch | 679 bytes | Garrett Albright |
Comments
Comment #1
hass commented+
Comment #2
jose reyero commentedLooks like a good idea to me. Committed, thanks.
Comment #4
sadist commentedHi Garrett. Thanks for the patch.
Trying to use it for my own custom theme, I wonder how does it works actually? What I'm trying to achieve is for my theme, to only call a custom css file against the current language of the page.
So I place the file i18n-en and i18n-es (or other languages) in my theme directory and it will automatically call i18n-en if it's in English?
Comment #5
Garrett Albright commentedNo, this patch does not include different CSS files for different languages. Instead, you can use a different selector on the
<body>tag for the language you want to target. So, for example, to make text marked with the<strong>tag red, except for on Spanish pages where you want it to be blue…Not a very practical example, but hopefully you get the idea.