Get the language in qTranslate-XT

Switch language on qTranslate-x

Intro

Here’s how to display different content when switching languages using qTranslate-x plugin. The WordPress Plugin qTranslate-x is really handy it allows you to translate your web pages easily and dynamically without creating a duplicate of your content unlike WPML Plugin. Well, each of them has its own pros and cons. Unfortunately the authors stopped working on it and left the plugin outdated for major updates of WordPress including Gutenberg. The WordPress community really want to save the project and willing to donate if there are group of developers who will continue the project. You can see the reviews on the plugin page.

But, for those who are still using the plugin including me. Here is how you can change content when switching the language.

  if ( qtrans_getLanguage() == 'en' ) {
    //your code or content here
  }
  elseif ( qtrans_getLanguage() == 'fr' ) {
    //your other code or content here
  }

The qtrans_getLanguage() is used to check the current language if ‘en’ or ‘fr’. You can always refer to the plugin documentation. Now you can display different content when switching languages using qTranslate-x plugin.

Question

What are your thoughts about bringing back the q-translate-x?
Share with us if you have any alternative for q-translate-x.

Great News!

A new qtranslate-x is being maintained by qtranslate community in github! Check this link. https://github.com/qtranslate/qtranslate-xt