WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Modifying qTranslate

[Resolved] Modifying qTranslate

  • 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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    @keesiemeijer

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

    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.

    <?php  
    
    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.

    is it possible to set language similarly?

    thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Modifying qTranslate’ is closed to new replies.
Skip to toolbar