Language Classes with i18n Module

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by CraigBertrand on December 15, 2009 at 6:28am

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_.txt 9.13 KB

Comments

I think it's a good idea. Do

Posted by Garrett Albright on December 15, 2009 at 4:31pm

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...

Posted by CraigBertrand on December 16, 2009 at 3:24pm

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

Posted by mandclu on December 16, 2009 at 3:28pm

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

Posted by Garrett Albright on December 16, 2009 at 5:40pm

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

Posted by CraigBertrand on December 19, 2009 at 8:20am

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

Posted by Garrett Albright on December 21, 2009 at 4:40pm

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.

Posted by CraigBertrand on December 22, 2009 at 1:46am

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

I wonder why this feature isn't there?

Fixed in Drupal 7

Posted by johnalbin on December 31, 2009 at 6:42am

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 :)

Posted by CraigBertrand on December 31, 2009 at 7:41am

Looks like you guys were one step ahead.

AltStyle によって変換されたページ (->オリジナル) /