28 September 2008
Multilingual Wordpress blog
This blog uses the Wordpress blog platform. All articles are available in French and English, and the interface of the blog is fully translated.
To do this, I use the qtranslate plugin. It enables to write easily articles, tags and categories in multiple languages. Default Wordpress widgets are also supported.
Use
The plugin modifies the administration of Wordpress by adding a field for each language for articles, tags and categories. For the rest, you have to use a very simple tags system: [ lang_en]English text[ /lang_en][ lang_fr]Texte français[ /lang_fr]
I use too on this blog many other plugins (for the widgets on the right for example). I had to slightly modify almost all plugins to support the languages tags system. You just need to add a call to the __() function – used in Wordpress to translate the interface using .mo files – to translate the strings before they are displayed using the languages tags system.
To enable users to switch from a language to an other, the plugin provides a widget to display. I rather liked to add the links on the top right of the page by inserting <?php echo qtrans_generateLanguageSelectCode('both'); ?> in the header of my template.
Improvements
For now, qtranslate doesn’t provide any system to detect the user language. I added on my blog a message that shows below the header if there is a more adapted translation of the blog available for you.
To do this, I inserted in the header of my template the PHP code in this file.
![[lang_fr]Capteur MicaZ[/lang_fr][lang_en]MicaZ sensor node[/lang_en] [lang_fr]Capteur MicaZ[/lang_fr][lang_en]MicaZ sensor node[/lang_en]](/wp-content/uploads/2008/09/micazresized.png)

![[lang_fr]Maisons dans le désert en Inde[/lang_fr][lang_en]Houses in the desert in India[/lang_en] [lang_fr]Maisons dans le désert en Inde[/lang_fr][lang_en]Houses in the desert in India[/lang_en]](/wp-content/uploads/2008/07/p1010840.jpg)
![[lang_fr]Widgets UWA : write once, run everywhere[/lang_fr][lang_en]UWA widgets: write once, run everywhere[/lang_en] [lang_fr]Widgets UWA : write once, run everywhere[/lang_fr][lang_en]UWA widgets: write once, run everywhere[/lang_en]](/wp-content/uploads/2008/06/uwa.png)
![[lang_fr]Logo de TvOnResEl[/lang_fr][lang_en]Logo of TvOnResEl[/lang_en] [lang_fr]Logo de TvOnResEl[/lang_fr][lang_en]Logo of TvOnResEl[/lang_en]](/wp-content/uploads/2008/06/logo-tvonresel.png)
![[lang_fr]Logo de Netvibes[/lang_fr][lang_en]Netvibes logo[/lang_en] [lang_fr]Logo de Netvibes[/lang_fr][lang_en]Netvibes logo[/lang_en]](/wp-content/uploads/2008/06/netvibes-logo.gif)
![[lang_fr]Logo de l\\\'UBO[/lang_fr][lang_en]UBO logo[/lang_en] [lang_fr]Logo de l\\\'UBO[/lang_fr][lang_en]UBO logo[/lang_en]](/wp-content/uploads/2008/06/logo-ubo.gif)
![[lang_fr]Un mini module Netvibes[/lang_fr][lang_en]A Netvibes mini module[/lang_en] [lang_fr]Un mini module Netvibes[/lang_fr][lang_en]A Netvibes mini module[/lang_en]](/wp-content/uploads/2008/05/miniapi.jpg)
![[lang_fr]Capture de mon premier site internet[/lang_fr][lang_en]Screenshot of my first website[/lang_en] [lang_fr]Capture de mon premier site internet[/lang_fr][lang_en]Screenshot of my first website[/lang_en]](/wp-content/uploads/2008/05/capture-deux-nants.png)
![[lang_fr]Logo du fil à soi[/lang_fr][lang_en]Logo of Le fil à soi[/lang_en] [lang_fr]Logo du fil à soi[/lang_fr][lang_en]Logo of Le fil à soi[/lang_en]](/wp-content/uploads/2008/05/logo.gif)



