Change qTranslate text – qtrans_generateLanguageSelectCode(”)

qTranslate allows you to insert a Language Selector on your theme by using this line of code:

<?php echo qtrans_generateLanguageSelectCode($type); ?>

If you define $type as ‘image’ you will get flags, if you define it as ‘text’ you will get language words.  And there are some other options also, let’s quickly review them:

  • ‘image’
  • ‘text’
  • ‘both’
  • ‘dropdown

So you select ‘text’ and the words ‘english’, ‘french’, ‘spanish’, ‘other’, etc, start appearing in your theme and you would like to change them to something like ‘EN’, ‘FR’, ‘ES’, etc.

How do you change those words

So, you’re searching on internet looking a way to change the qTranslate text generated by that line of code, but the true is: there’s no easy way of changing these words yet (may be in future releases).  We will tell you how to quickly change it.  Just insert the following on your theme where you want the language selector to appear:
<?php echo qtrans_generateLanguageSelectCode('text'); ?>
<script>jQuery(document).ready(function(){ jQuery('.lang-en a span').html('EN'); jQuery('.lang-fr a span').html('FR'); })</script>

Quick, easy, and you don’t have to spend 2 hours on internet searching how to do it.   Let them update the plugin in the future and integrate this funcionality, meanwhile just go and do whatever other thing you have to do on your theme…