Today I received a question of one of my readers. His question was how to translate (the content of) a widget when you use qTranslate. Actually, this isn’t very difficult. In this short article I’ll show you 2 ways to handle this problem.
Important note, you must have installed qTranslate first!
1. Translate Your Widget Using the qTranslate Tags
The first option is by using the tags. For example:
This is very simple, just add the tags for every language you need and write the text between these tags.
Translating the title won’t work this way, therefore you need the 2nd option:
2. Translate Your Widget Using the Widget Logic Plugin
First download and install Widget Logic.
Once installed and activated, you’ll see that you have an extra field at the bottom of your widgets, called “Widget Logic”. You can use this field to add a condition of when the Widget must be shown.
Here you can also add the code to show the widget depending on the language your visitor chose:
The code filled in in this field is:
qtrans_getLanguage()==’en’
Don’t forget to save the widget!
Conclusion
Translating your widgets is an important part of translating your blog or web site. Thanks to the qTranslate tags or the Widget Logic plugin, translating the text inside your widgets is very easy!