Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a situation where I want to give specific style to my Navigation Menu when the website is in German language.

My website works well in English language but when I switch to German, it causes a css problem.

So how do I determine which language is currently active with qTranslate plugin?

share|improve this question

closed as off-topic by Mark Kaplun, Johannes Pille, shea, birgire, Pieter Goosen Oct 5 '14 at 5:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Mark Kaplun, Johannes Pille, shea, birgire, Pieter Goosen
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

You can use the qtrans_getLanguage() function.

$currentLang = qtrans_getLanguage();

return the current language. See this link for an example

share|improve this answer
Unfortunately, both links are not working, official docs is redirected to WordPress forum. – Dharmang Jul 23 '14 at 11:05
Thnak's. I've removed the broken link. – keatch Mar 5 at 0:15
Notice that qtranxf_getLanguage should be used instead for qTranslate X. There is also some compatibility functions in the plugin options according to this – toto_tico Sep 30 at 16:13

I have found a possible solution:

if ( 'de' === $GLOBALS['q_config']['language'])
    echo "<style>#nav li a { margin-left:3px !important; }</style>"; // menu bar width fix

This works well for my menu items being not looking wired.

share|improve this answer
Thanks Kaiser. Does this method work for all global variables? – Darshan Thanki Sep 23 '12 at 8:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.