WPML String Translation Addon – Anything that doesn’t fall inside posts, pages or taxonomy. This includes the site’s tagline, general texts in Admin screens, widget titles and many other texts.
Activating the module
WPML’s String Translation module is part of the Multilingual CMS package. To enable it, you first need to download and install it from your WPML.org account > Downloads section. Then, go to WPML->String Translation.
Choosing Which Strings to Display
A complex site may contain many strings to translate. Use the display filter, at the top of the String Translation page, to determine which strings to display.
- Which strings to display – choose the translation status (everything, translation complete, translation needed or waiting for translator)
- Strings domain – WPML organizes strings into different domains, making it easier to find a specific string. If for example you are looking for a widget string, select the “Widgets” domain
- Search – you can enter a search value to narrow down specific strings
Click on the translations link to open the translation editor. Be sure to click on ‘translation is complete‘ after you translate. Incomplete translations will not appear in the site. If you are using WPML’s Translation Management module, you can also send strings to translation by your translators. Click on the checkboxes next to strings, select the language from the list (in the Translation options box) and choose to send to translation. Please note that you cannot choose a specific translator. All translators within a language pair would be able to translate the strings you’ve chosen.
Perhaps you not longer use a certain theme or plugin and you wish to remove the strings associated with it. Simply select the strings you want to remove and click “Delete”.
Original Language of Strings
You can set the source language of specific strings or all strings that belong to a domain (context). To change the language of specific strings, select them and click on the new Change language of selected strings button. Then, select the new language. You can also change the language of entire contexts. This is useful when you get a theme or a plugin, that’s coded in a language other than English. Click on the new link, at the top of the String Translation page, Language of domains. Then, choose the new language. The dialog will show you a table of the strings in that domain. You can choose the new language and also make it the default language for new strings that will be added to that domain.
Advanced String Translation Features
Besides the basic filter and translation features, WPML offers advanced options, which can make your site administration simpler.
Track when strings appear on the site
This option helps you identify where strings are used on public pages in the site. When enabled, WPML will keep record of the PHP source and pages that display each string. This feature can help understand the correct context of strings and how they should be translated. How to use:
- Enable the option to ‘Track where strings appear on the site’.
- Visit the site’s front-end pages.
- Switch to a language other than the site’s default language.
- WPML will register any string that appears on the page you are viewing. Move from page to page to cover all the strings you need.
Please note that this is a database-intense operation. You should only enable it when building the site. When you are done registering strings, don’t forget to return to the String Translation admin page and disable ‘Track where strings appear on the site’. Your site’s speed will be significantly lower if you keep this option running in production mode.
Auto register strings for translation
WPML uses static code analysis to locate strings that require translation in the theme and plugins. In some cases, the static code-scan cannot reliably find all strings. This often happens when strings are generated dynamically using code (not really static/”hard-coded”). By enabling auto registration, WPML will register strings that need translation at display-time. The conservative option is to register strings when logged in as an administrator. This means that when a logged-in admin browses the site, WPML registers for translation any strings that are displayed. This operation may increase the amount of database queries while strings are registering for translation.
Import / export .po
You can import translations from other sources and export your current translations using .po files. If you choose to export strings without their translations, the file extension will be .pot (Portable Object Template). If you choose to include translations, the extension would be .po. When you import translations, you must choose the language to import to.
Translating strings in the wp_options table
Many themes and plugins store texts in the wp_options table. This is also the case with Widgets. Widgets also store their setting fields in the wp-options table. You can tell WPML to register these strings to translation. To do this, click on Translate texts in admin screens. This will open a GUI, showing the strings that WPML finds in your site. The list will often be a tree, which you can expand and collapse. Developers note: Theme and plugin authors are encouraged to include a language configuration file in their code, which tells WPML which strings from the wp_options table to register for translation. This can save a lot of time for end-users configuring multilingual sites. You can easily export the strings you want by using the “Export selected strings as a WPML config file that can be added to themes or plugins ” button (see image above). If your option includes a lot of sub-options, you can use the asterisk (*) as a wildcard character in your configuration file. You can find more information and examples on our page about creating language configuration files.