[resolved] Modifying qTranslate (4 posts)

  1. bluedrag
    Posted 4 years ago #

    I'm trying to have my own php code run if a certain language is active in the qTranslate plug in but I can't seem to find the right variables to use. heres a little pseudo-code of what I'm trying to do.

    if(languageCode == en) {
    //run my own code
    if(languageCode == fr) {
    //run different code

    Hopefully someone can help me with this, thanks!

  2. keesiemeijer
    Posted 4 years ago #

    Try this it with: if(qtrans_getLanguage()=='en') { ... }

  3. bluedrag
    Posted 4 years ago #

    Thanks! I got it working!

    A little note for people trying to get qTranslate to only display the none active language, this is how you do it.

    if(qtrans_getLanguage() == 'en'){
    	echo '<li class="lang-fr active"><a href="http://konggraphics.com/wordpress/?lang=fr" hreflang="fr" title="Fran├žais"><span>Fran├žais</span></a></li>';
    if(qtrans_getLanguage() == 'fr'){
    	echo '<li class="lang-en active"><a href="http://konggraphics.com/wordpress/" hreflang="en" title="English"><span>English</span></a></li>';

    This code will display an anchor to change to active language to french when english is active and english when french is the active language.

  4. janper
    Posted 4 years ago #

    is it possible to set language similarly?


Topic Closed

This topic has been closed to new replies.

About this Topic