Adding Localization Using WPML
From this tutorial you’ll learn how to add localization to your WordPress template and plugins using WPML plugin.
- First, let’s install WPML to WordPress. To do it you need to get a WPML account. Here navigate to Downloads and download the WPML components package.
- Unzip each of the components. Then add all of the components contained in the separate folders to one archive.
- Upload them to wp-content/plugins folder using FTP tool or Upload option in your hosting server cPanel file manager.
- Uncompress the package.
- Now navigate to WordPress Dashboard > Plugins tab and activate WPML components.
- Let’s locate theme and plugins localization settings. Locate WPML > Theme and plugins localization tab on the left of the Dashboard.
- Here you can create translations for texts in themes and plugins. You can use the translations you already have, as well as string translation.
- To use the .mo files as the translation backup files check Translate themes and plugins using WPML’s String Translation and always load .mo files as backup.
- In the case, you’re translating using String Translation only, check Translate themes and plugins using WPML’s String Translation only (don’t load .mo files).If you select loading the .mo file as a backup, WPML will relay back to .mo file if there are such in your theme and plugins.
In the case, you see the translation string which is not under the String Translation, then it comes from .mo file in the theme or plugin.
- If the text strings are in English, then check Assume that all texts in PHP are in English.
- WPML will scan the theme and locate the text to be translated. It will show you all the strings and you’ll be able to enter the translation right from WordPress Dashboard.
To start manual scanning for texts please, select the theme or a plugin you want to scan and click on Scan selected themes/plugins for strings.
- You’ll see how many strings are there for translation.
- Navigate to WPML > String Translation tab.
- Select the domain (the theme’s or plugin’s name) which texts you need to translate.
- Click the translations link on the right of each string and add the translation for the text.
- When the translation is complete you’ll be able to switch the languages for the themes and plugins on the website. To learn how to do it, please, feel free to read Adding Language Switcher with WPML Plugin tutorial.
This tutorial is based on Bellaina Real Estate WordPress theme.