Download & Extend

Add the current language to the body class

Project:Zen
Version:6.x-1.x-dev
Component:PHP Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Issue tags:language

Issue Summary

Patch attached - this patch is for the template.php in Zen - all subthemes would inherit.

AttachmentSize
add-lang-class.patch405 bytes

Comments

#1

I'm not 100% sure this feedback applies because I'm not using Zen; however, I borrowed the zen_preprocess_page function for my own theme. I needed to also add the language body class, but I had to change $language->prefix to $language->language to get it to work. The $language->prefix variable was empty on my pages for some reason, but $language->language worked great.

#2

Version:6.x-1.0-beta3» 6.x-1.x-dev
Status:needs review» reviewed & tested by the community

New patch doing this "properly" (e.g. adding a new element to the $classes array prior to building the body_classes variable) attached. Marking R&TBC, because I've just used this on a production site and it's fine. And this issue is ages old - be good for multilingual site builders to get this in to the next release. ;-)

AttachmentSize
456096-zen_language_classes.patch 519 bytes

#3

Actually there is the language selector you can use?

http://www.w3.org/International/questions/qa-css-lang

#4

That's cool. Didn't know about that. It probably does negate the need for this patch, but it's little known, so in a way the class is easier because it's obvious to all.

nobody click here