By Meni-1 on
Hello.
Anyone ever tried displaying different themes for different languages? My case is extremely frustrating since one language is LTR and the other is RTL. All I want to do is simply switch to a different theme when selecting a certain language.
Thanks for your help.
Comments
Just an idea...
Hello Meni,
I think this is a interesting question so I gave it a try. As always there is no right or wrong no golden way to solve this.
So one solution might be to wrap the print $styles code of your page.tpl.php head with a if block. Based on a PHP super global called HTTP_ACCEPT_LANGUAGE you can detect the browser language an change the theme/style accordingly.
HTTP_ACCEPT_LANGUAGE will output something like this: "de-de,en-us;q=0.7,en;q=0.3". So you have to explode it into array. In this very simple version I check only the first array element $langcodes[0].
There a some scripts out there that will help you furhter finetune your detection: http://techpatterns.com/downloads/php_language_detection.php
With best regards
Mike
Thanks for the reply Mike. I
Thanks for the reply Mike.
I had something a bit more simple in mind. But my lack of knowledge in Drupal is what leads me to ask...
I am usging the i18n module and I LOVE it. All I need is one simple "if" that will check if I am currently viewing the LTR language or the RTL one.
Then - according to the "if" i will select the theme.
Where exactly would I find the theme selection procedure in the Drupal code?
I don't mind hardcoding the theme selection in PHP and losing the ability to control it through the admin panel.
Any ideas?
anyone?
anyone?