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?

2 Answers 2


You can use the qtrans_getLanguage() function.

$currentLang = qtrans_getLanguage();

return the current language. See this link for an example

  • Unfortunately, both links are not working, official docs is redirected to WordPress forum.
    – Dharmang
    Commented Jul 23, 2014 at 11:05
  • Thnak's. I've removed the broken link.
    – keatch
    Commented Mar 5, 2015 at 0:15
  • 3
    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
    Commented Sep 30, 2015 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.

  • Thanks Kaiser. Does this method work for all global variables? Commented Sep 23, 2012 at 8:09

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