Change CSS Style with each language
May 28, 2011 10:17 am by siliconstudio
May 28, 2011 10:17 am by siliconstudio
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?
Re: Change CSS Style with each language
May 31, 2011 8:07 am by Edvard
May 31, 2011 8:07 am by Edvard
You can try to modify the javascript doTranslate function and make your CSS changes there depending on the selected language.
Re: Change CSS Style with each language
Aug 8, 2012 10:36 pm by SteckInsights
Aug 8, 2012 10:36 pm by SteckInsights
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!
Re: Change CSS Style with each language
Aug 13, 2012 9:10 pm by Edvard
Aug 13, 2012 9:10 pm by Edvard
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#:~:text=glang
SIMILAR TOPICS
Large numbers of crawl errors with double language code | Jan 24, 2019 1:43 am | Replies: 1 | Post by: natastna2 |
Translate website to any specific language, on page load | Jan 19, 2019 6:49 am | Replies: 1 | Post by: Leaon7756 |
Graphic translation for every language is missing | Dec 19, 2018 7:54 am | Replies: 1 | Post by: Daryl Dixon |
How to remove mobile Language Select Button transparency | Dec 5, 2018 10:06 pm | Replies: 10 | Post by: JeffTR |
Change language automatically | Nov 26, 2018 9:29 pm | Replies: 3 | Post by: Antilb |