WordPress Tutorials and Blog Posts

How to Build Multilingual WordPress Sites

tutuploadsmedia_1326913896708.pngIt is possible to build great multi-lingual sites with WordPress. The WP core is not multi-lingual but there are several plugins available including WPML, xili-language, Polylang, qTranslate, Transposh and Global Translator.

In this tutorial, we're going to explain how those plugins work and help you decide which one is right for your needs.

The multilingual plugins fall into at least five distinct types:

  1. Plugins that create a new post for each translation of a post. These plugins then link the separate posts together and provide an indicator that one is a translated copy of the other. Examples are WPML, xili-language and Polylang.
  2. Plugins that store all the translations of a post in the original post. An example is qTranslate.
  3. Plugins that automatically generate a translated copy of all your pages using an external service. Examples are Transposh and Global Translator.
  4. Plugins that automatically generate a translated copy of your page, but only when a visitor requests it. An example is Google AJAX Translation.
  5. Plugins that link together separate WordPress installations for each language. An example is Multisite Language Switcher.

Every approach has its advantages and disadvantages. If you want to explore the pros and cons of each, visit the WP codex and read more about your choices.

The purpose of this tutorial is to pick one of these methods and show you how it works. This will not be an exhaustive manual for implementing multi-language sites, but you will be able to manage more than one language with the techniques demonstrated.

In this tutorial, we'll show you how to:

  • Translate the core of WordPress.
  • Change the administrator's language.
  • Manage multi-lingual posts.
  • Allow your users to switch languages by using a widget.

Step 1. Download and install language files

There are two types of files that deal with language. Site-wide labels and messages are handled in files with the extensions .mo and .po. These files are part of the WordPress core, or are added by plugins and themes to handle extra text. Many contributors have created files you can use for this, and there are language localization teams you can consult.

If you want to add a language other than English to your site, you can do one of three things:

  1. Install a complete copy of WordPress written especially for your desired language.
  2. Manually install language files on an English installation. You can download available translations from this page. To manually install a language file after you've downloaded it, place the language files in /wp-content/languages/.
  3. Use a plugin.

We're going to use option #3. We're going to use these two plugins:

  • WP Native Dashboard for translating your admin area.
  • qTranslate for translating the content on the front of your site.

Step 2: Download and install the Native Dashboard plugin

tutuploadsStep_2_Download_and_install_the_Native_Dashboard_plugin..png
  • Go to your dashboard.
  • Go to Plugins then Add New.
  • Search for WP Native Dashboard.
  • Click Install after you find it.

This plugin enables the selection of your preferred language.

This plugin also includes a repository scan on demand (svn.automattic.com) for available language file downloads. You can download the required files into your installation and immediately use them on admin pages.

Step 3: Access the plugin settings

tutuploadsStep_3_Access_the_plugin_s_settings.png

Access it by going to your Dashboard, then Settings, then Native Dashboard.

tutuploadsmedia_1326773478897.png

At the top of the settings page you can click the check boxes to enable the capabilities you want. In the Downloads pane, click check repository to find the language you want to install.

  • Capabilities: choose one or a combination.
  • Logon screen extension: the user can specify his/her preferred language during login.
  • Dashboard quick switcher extension: the user can easily switch language on every admin page.
  • WordPress admin bar switcher: the user can switch language via the admin bar.
  • BuddyPress admin bar switcher: the user can switch language via the BuddyPress admin bar.
  • User profile setting: the user can define their preferred language via their user profile.

Step 4: Install the language files using the plugin

tutuploadsStep_4_install_the_language_files_using_the_plugin.png

The link to the downloads page should activate the progress bar, as shown in the picture above. When it is finished, you will have a list of language files to download. Be patient because this might take a while if you have a slow connection.

If clicking "check repository" doesn't initiate the svn search, you may not have a languages directory. Check your site's folders. There needs to be a writable languages directory located at /wp-content/languages/ otherwise the process fails. After creating the directory, make sure one of the Capabilities is checked and save the change. Then try the "check repository" link again.

tutuploadsmedia_1326774839050.png

Click the Download link to install the package.

An additional flag for each language will be added to the Installed Languages pane for each one you add.

Warning: Some languages provide a special xx_XX.php file disabling your login. Currently Russian (ru-RU) requires a small modification. The failure reason is the additional file needed for russian language named “ru_RU.php” in cooperation with your wp-config.php file. Change this line in your wp-config.php file to read:

$wp_default_secret_key = 'впишите сюда уникальную фразу';

tutuploadsmedia_1326775441813.png

On login, you will be presented with a language choice. Your members will be able to save the choice in their profile or login with their native language when they enter the site.

The main goal of this plugin is to control which languages can be used in the WordPress admin area. This addition of a language can only be managed by administrators. Other user can change the language they see, but not add a new language. The administrator defines what is allowed in the configuration by choosing one or a combination of the following settings:

  • extend the WordPress login screen
  • extend the backend header with quick switcher
  • extend the user profile settings

This only changes the language of administration pages. We still need to deal with the front end language. It does not allow you to create posts or pages in multi-language versions. You will need another plugin for the front end view.

Step 5: Change the administrator's language

tutuploadsStep_5_Change_the_administrator_s_language.png

This plugin will add a language selector to your admin bar. You will be able switch the languages in the administration from a dropdown menu.

Step 6: Download and Install qTranslate

tutuploadsStep_6_Download_and_Install_qTranslate.png

Go to your Dashboard, then Plugins, then Add new and search for qTranslate. Click Install Now.

qTranslate works best when installed on a site with no content. It will work fine if there is content, but there will be extra configuration steps involved. I suggest you install this on a test site first.

Step 7. Settings for qTranslate

tutuploadsStep_7._Settings_for_qTranslate.png

Go to Settings, then Languages to return to configure qTranslate.

tutuploadsmedia_1326778274906.png
  • Choose the default language.
  • Choose to Hide Untranslated Content or to show it. Read the instructional paragraph on the page for details on which is right for you.
  • Click Advanced Settings (Show) to expand that pane and configure those options.
  • Click qTranslate Services Settings (Show) to configure those options.
  • Save any changes you make.

Note: qTranslate Services is a connection to a commercial translation service or an automated free service. Web Translations Services uses a network of freelance, in-country translators to return posts that sound natural to a native speaker of the language. There is also a free automated service, but it will only return a suggested translation that will not read naturally. You need an account with Web Translations Services for either the free or paid services.

Step 8. Configure language options

tutuploadsStep_8._Configure_language_options..png

On the settings page you can configure specific settings for each language. Different countries use different conventions for date format and other localization specifics.

For an idea of what you need to configure click "Edit" for one of the pre-installed languages on the language table to the right of the page. A picture of the language table is below.

tutuploadsmedia_1326779204464.png

Choose additional languages. Deutsch, English and Chinese come pre-installed and enabled. You can simply enable any language you see here, and you can edit the files.

In the picture, Deutsch (German) is enabled. Francais (French) is disabled and can be enabled by clicking on the word "Enable".

tutuploadsmedia_1326779376381.png

The above image shows a sample of the edits you can make on a language file.

Step 9: Translate the post titles

tutuploadsStep_9_Translate_the_post_titles..png

Go to create or edit a Post.

You will be able to translate the post titles by typing the translations in the correct fields.

This is the easiest but also the most time consuming part of the process. Go to any post, page or category and you'll see editing windows for each language. Just write the translations in the appropriate fields. You have tabs for each version of the page.

Step 10: Translate the post content

tutuploadsStep_10_Translate_the_post_content.png

Next to the Visual and HTML tabs you now have additional viewing tabs, one for each installed language. Choose the tab you want and write the article there in the chosen language.

Step 11: Add the language switching widget

tutuploadsStep_11_Add_the_language_switching_widget..png

Go to the Dashboard, then to Appearance, then Widgets and drag the qTranslate Language chooser onto a sidebar.

tutuploadsthe_module.png

The image above shows the widget in the sidebar. I chose Chinese so you could easily see what would be translated by the uploaded language file. You can also see the parts that would need to be translated manually.

With these two plugins and the proper language file, you can present various languages on both the frontend and admin area of a WordPress site. Users can choose a language when they login so they can always be reading in their native tongue.

Comments

 
Ian Broom
#1 Ian Broom 2012-01-26 15:15

We find setting up a wordpress network, setting each blog in the network to a language, and using a redirection template based on the user's language settings works better - it means each site can be configured differently and doesn't need to be translated into all the different languages before it is put live.

See blog.viadeo.com for an example
 
 
Frank
#2 Frank 2012-01-26 15:25

please see also this solution Multilingual Press
 
 
steve
#3 steve 2012-01-26 15:26

Thanks Frank. A link to Multilingual Press on WP.org: wordpress.org/.../...
 
 
Frank
#4 Frank 2012-01-26 16:09

Thank you; i had this include my comment via html, but maybe you filter the comments. Thanks.
 
 
Ejaz Siddiqui
#5 Ejaz Siddiqui 2012-01-27 05:36

Thanks Ed for an excellent Article,
I myself use qTranslate on www.karcpp.org and it works like a charm.
 
 
Nick
#6 Nick 2012-02-01 05:36

You're welcome, Ejaz! :)

Kind regards,
Nick
 
 
Nick
#7 Nick 2012-02-01 05:38

You're welcome, Frank! Yes, sometimes the comments can be buggy, but overall it's been working great for us.

Kind regards,
Nick
 
 
David Innes
#8 David Innes 2012-03-05 16:47

Where qTranslate works it works very well. On the other hand I'm struggling to get it to translate menu items, widget text, and even obvious stuff like the title and tagline in General Settings. (Most often the qT tags are simply stripped out. Other times they're just ignored.)

I'm very reluctant to modify the template itself to accommodate translation for reasons that include a) it's a proprietary template (PageLines) and b) I hand the project off to complete non-techies upon completion of my contract.

Any ideas?

This is an excellent tutorial, by the way. And since pretty much everyone else also omits the menu/settings-s trings translation problem I guess it's no problem that you don't either. (Or am I just missing something really, really obvious?)

Thanks!
 
 
Katie Camacho
#9 Katie Camacho 2012-04-17 10:46

Hi Ed, Thanks I found this post very useful. Careful planning and experimentation is a must to make the right decision on how to make your site multilingual. I agree that the qTranslate plugin makes WordPress very multilingual friendly. It is also linked with a professional translation agency Live Translation which allows users to buy professional human translated website posts directly from the WordPress dashboard using PayPal, that is very helpful!
 
 
pramanshu
#10 pramanshu 2012-11-02 11:26

Hi, this is post is very useful to me.thanks......
 
 
muhtarul
#11 muhtarul 2013-01-04 08:34

i use wp 3.5 and i there,s no download link for indonesian. really need help
 
 
XDude
#12 XDude 2013-01-04 18:34

This appears to be highly-excellen t and exactly what I need! Thank you.

I don't suppose you have a live, working example site somewhere?
 
 
Costel
#13 Costel 2013-02-07 05:33

Best articole from this category!
Many tanks!
 

Add comment


Security code
Refresh

blog-ad

Start Online Training

Members get access to all our video training. That's 1,141 training sessions in Joomla, Drupal, WordPress and Coding.

Manage All Your Joomla Sites

adminicredible

With Admincredible you can update and manage all your Joomla sites. If you have 5 or 500 sites, Admincredible will make your life easier! Visit Admincredible.com.

Latest Comments

The License for Our Tutorials

All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means:

  • You can re-use these tutorials.
  • You can modify these tutorials.
  • You must link back to our original tutorial.
  • You can't use these tutorials commercially.

Click here to read the full license.

Open Source Training is not affiliated with or endorsed by the Joomla, WordPress or Drupal projects.
All product names and trademarks are the property of their respective owners.

Copyright 2013 Open Source Training, LLC. All rights reserved.