Change CSS Style with each language

Popular automatic website translation tool

Change CSS Style with each language

Postby siliconstudio » Sat May 28, 2011 2:17 pm

In WordPress I have a fixed width menu and my original layout was optimized for English. Selecting some other languages forces my menus to over-run the menu area which doesn't look nice.

What I want to do is to automatically change (CSS) style classes depending on the language chosen by the user, so that parameters like font-size and menu padding change on-the-fly and the menu remains in the menu area without over-running the fixed width menu area.

Does anyone have any ideas on how to do this, most likely in PHP?
siliconstudio
 
Posts: 1
Joined: Sat May 28, 2011 2:02 pm

Re: Change CSS Style with each language

Postby Edvard » Tue May 31, 2011 12:07 pm

You can try to modify the javascript doTranslate function and make your CSS changes there depending on the selected language.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Change CSS Style with each language

Postby SteckInsights » Thu Aug 09, 2012 2:36 am

SiliconStudio, did you have any luck with this? I've been messing around with trying to declare a custom body class depending on the URI returned by GTranslate, but for some reason that's not working.

Did you figure out a solution by modifying "doTranslate"?

I try to avoid modifying the functions directly because I don't want them to get erased on the next GTranslate update.

Thanks, in advance!
SteckInsights
 
Posts: 11
Joined: Thu Jul 12, 2012 12:46 am

Re: Change CSS Style with each language

Postby Edvard » Tue Aug 14, 2012 1:10 am

You may also check for currently selected language.

In Enterprise version it sets a header X-GT-Lang which you can access with $_SERVER['HTTP_X_GT_LANG'].

To get the current language code in Pro you can read this: url-language-code-t320.html?hilit=glang
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux