Home » Documentation » Getting Started Guide » Theme and Plugins Localization

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.

Enable translation by WPML

Enable translation by WPML

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 allow WPML to provide translation texts in the theme and plugins.

When WPML localization is 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.

Scanning the theme for strings

Scanning the theme for texts

Scanning the theme for texts

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 plugin for strings

Similarly to the theme, WPML can scan plugins and find translatable strings.

Scan plugins for texts

Scan plugins for texts

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.

Translation texts via WPML's String Translation

Translation texts via WPML’s String Translation

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.

Specifying the locales for different languages

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’.

Locale settings

Locale settings

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.

Automatic download for WordPress translations

Automatic download for 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.

How to download WordPress translation as .mo files

How to download WordPress translation as .mo files

To enable localization for your language, you need to do two things:

  1. Set the language locale file in the Locale file name column.
  2. Download the WordPress locale file and save it to wp-includes/languages. The download links are provided in the table above (click on the language name).