Theme and Plugins Localization
WPML allows to get translations for texts in themes and plugins in two ways:
- The traditional .mo files (good for when you already got that with the theme).
- Translating the theme’s texts directly from WPML
This setting is located in WPML->Theme and plugins localization.
Themes and plugins load their .mo files with translations, without you having to do anything. No matter what you choose in WPML’s translation options, the theme will always load its built-in translation.
When you select Translate using .mo files, you simply tell WPML not to allow editing these translations using the String Translation module.
Translating the theme and plugins from within WPML
Note: this option requires WPML’s String Translation module, available as part of the Multilingual CMS package.
Select Translate by WPML, to manage translating texts in the theme and plugins from WPML’s String Translation admin screen.
With this option selected, WPML will scan the theme and find the texts that can be translated. It reports what it finds and let you enter translations, right from within WordPress.
Worth noting here is that Translate by WPML will fall back to .mo file translations if those exist in your theme and plugins. This means that if you see a translated text string in your site and which is not registered under String Translation chances are that the translation comes from an .mo file.
Scanning the theme for strings
Click on Scan the theme for strings and WPML will go through all the files in the active theme and get translatable texts from them (texts that are wrapped with gettext functions).
If you select the check-box Load translations if found in the .mo files, WPML will use any translations provided by theme’s .mo files. These will be the initial translations and you can edit them later via WPML’s String Translation.
The scanner shows how many strings were found in the theme and their translation status. To translate them, click on View strings that need translation. This will take you to the String translation page, where you can enter translation for each of the texts found in the theme.
Scanning plugins for strings
Similarly to the theme, WPML can scan plugins and find translatable strings.
Select the plugins to scan, select Load translations if found in the .mo files if you want to use the initial translations provided in .mo files and click on Scan the selected plugins for strings.
Translating the strings
The String Translation screen is available to Admins and Editors.
If you’re also using WPML Translation Management module, you can choose strings and assign them for translation by your designated translators (available in WPML 2.3.0 and above).
Choose the strings to translate, to which languages and click on the button to send to translation. Your translators will be able to access the String Translation screen and translate just the ones that you’ve selected.
A locale is a code which determines which language variant to use for different languages. It’s comprised of a language/country combination.
For example ‘en_US’ means American (USA) English and ‘en_GB’ means English used in the UK.
The locales table in WPML is already pre-populated with the correct values for all popular languages. You should edit it only if you want to use a different language/country combination or if you’ve added your custom languages. For instance, the default locale for Spanish is ‘es_ES’ (for Spain), but you can change it to Mexican Spanish by setting the Spanish locale to ‘es_MX’.
Getting Translation Files for WordPress Itself
Many of the texts in your site come from WordPress itself. This includes date formats, standard texts and the entire localization for the WordPress admin.
You can let WPML download these translations for you, or download and install them manually.
Option 1) Letting WPML download WordPress translations
WPML can automatically download the required translations for WordPress, for your site. This functionality requires the String Translation module. Once enabled, you’ll see an option for WPML to automatically download WordPress translations.
Follow this guide for downloading WordPress translations to see how it works.
Option 2) Downloading translations for WordPress manually
If you prefer to download the .mo files for WordPress manually, go to the WordPress localization project.
Choose the WordPress version that you are using, select the language and click on export to download the translation.
To enable localization for your language, you need to do two things:
- Set the language locale file in the Locale file name column.
- Download the WordPress locale file and save it to wp-includes/languages or wp-content/languages. The download links are provided in the table above (click on the language name).