I recently worked on a few multilingual WordPress build for different clients.
So I have been looking for the best way to build those using relavant code and plugins. Here is what I ended up using.
There are two approachs to build a multi-languages website with WordPress.
You can either use plugins as qTranslate or you can setup a network wordpress (have a WordPress for each language).
Both have advantages but I choose the network solution as it gives us more flexibility in terms of content.
The network wordpress / Multisite
Create a network wordpress is easy. Just follow the instruction from http://codex.wordpress.org/Create_A_Network
1) Allow Multisite
Add WP_ALLOW_MULTISITE to wp-config.php before the stop editing comment
define( 'WP_ALLOW_MULTISITE', true );
2) Tools menu > network
Configure your network by following the instructions
3) Enabling the Network
Add specified lines to your wp-config.php and .htaccess
Tada! Add your websites
How to build a bespoke wordpress theme for multi-languages
My recommendations to create a Wordpress multisite with one theme and different languages:
All textual content need to be in your CMS or displayed in your theme using
_e( 'Some text to translate and display.', 'textdomain' );
If you create custom fields for your website, for example a footer visible on every pages, add those fields to your home and use
get_option( 'page_on_front' ); to get the id of your front page.
I recommend to do a first website adding all the final content, and then use the export in “Tools” and then an import a copy of the content in your others websites. You can then translate the content easily and it will save you lots of time.
Have the wordpress backend in your language
No need for any plugins, just go to wordpress.org, download the wordpress in the language you wish, add the translations file of your new language to your wp-content/languages
Then, choose the language in Settings tab.
Plugins for a multilingual wordpress
- CodeStyling Localization: manage and edit all gettext translation files (*.po/*.mo) directly out of your WordPress without any need of an external editor
- Network Shared Media: This plugin adds a new tab to the “Add Media” window, allowing you to access media in other site.
- Multisite Language Switcher: simple but powerful plugin that will help you to manage the relations of your contents in a multilingual multisite-installation
Hope this can help, feel free to comment if your have better plugins, ideas, etc.