• Dear reader,

    I’m using the qtranslate plugin to make my site multilingual (http://www.studiosophisti.nl/wordpress). At the top a language switcher can be seen, it is customized because I don’t want to display both languages all of the time, just the language you can switch to. For that I use the following code:

    <?php if(qtrans_getLanguage() == 'en'){
    	echo '<class="lang-nl active"><a href="/wordpress/" hreflang="nl" title="Nederlands"><span>Nederlands</span></a>';
    }
    
    if(qtrans_getLanguage() == 'nl'){
    	echo '<class="lang-en active"><a href="/wordpress/?lang=en" hreflang="en" title="English"><span>English</span></a>';
    } ?>

    The problem with this, is dat it uses hardcode, so no matter on which page you are, it will redirect you to the homepage in the newly selected language. I’d like to have it so that it will redirect you to the same post/page, just in the new language.

    The standard code given by qtranslate which displays both languages is the following:

    <?php echo qtrans_generateLanguageSelectCode('both'); ?>

    Kind regards

The topic ‘[Plugin: qtranslate] Don't show current language’ is closed to new replies.