Language Classes with i18n Module

Events happening in the community are now at Drupal community events on www.drupal.org.
CraigBertrand's picture

Hey Guys,

I am working on my first multi-language site and we are using zen for our theme.

2010.gateway.org.hk (In heavy Development)

I was having a really hard time getting language classes so I could theme differently for each language and so I headed to irc.

A really helpful guy named (irc nickname) Cvelde wrote some code for template.php so I could get those classes in my site.

http://pastebin.com/f7637b1ab (also attached below)

The code goes write after "classes[] = 'with-wireframes'; // Optionally add the wireframes style..."

So my question/suggestion is should this be added into zentheme core?

If not then at least this post should help others with the same problem.

AttachmentSize
template.php_.txt9.13 KB

Comments

I think it's a good idea. Do

Garrett Albright's picture

I think it's a good idea. Do you know how to create patches? You should make one and submit it to Zen's issue queue.

Don't know how to make a patch...

CraigBertrand's picture

I could try to figure it out though.

However I was wondering if this functionality should be in the i18n module. It seems folks using other themes would need this fairly often. Perhaps I will raise a discussion there.

Definitely an i18n patch

mandclu's picture

I definitely think it would be more appropriate as a patch for i18n. Like you say, the need for this relates directly to the use of the module instead the Zen theme.

I went ahead and made a patch

Garrett Albright's picture

I went ahead and made a patch to i18n to do this. Here's the issue. Please review it if you can.

While it works great with Zen subthemes, unfortunately it won't work for Garland/Minelli. Argh.

Thanks

CraigBertrand's picture

Thanks Garrett,

I hope they will be able to figure out a way to make it work for all themes. Isn't there a hook somewhere that modules can add css classes/ids to the system before the theme even gets called? I am just a themer and drupal configure-er so I don't know if this is possible but It should be.

Anyhow thanks for taking the initiative to write the patch and submit it!

Craig

Isn't there a hook somewhere

Garrett Albright's picture

Isn't there a hook somewhere that modules can add css classes/ids to the system before the theme even gets called?

Not that I know of. You might be thinking of something in the direction of drupal_add_css() , but that's for adding CSS files, not classes or anything like that.

Yeah thats it.

CraigBertrand's picture

Yeah the "drupal_add_css" is what I had seen before.

I wonder why this feature isn't there?

Fixed in Drupal 7

johnalbin's picture

In Drupal 7, we've added a $classes_array variable (look familiar?) available in each preprocess function and you can modify/add to those classes. The $classes_array gets flattened automatically to a $classes string used in the corresponding template itself.

  - John (JohnAlbin)

That should do it :)

CraigBertrand's picture

Looks like you guys were one step ahead.