Strings translation

1. Filter
2. Translate strings
2.1 Create your translations
2.2 Widgets translations
3. Translate URL slugs
4. Cleaning the database
4.1 Cleaning the translations
4.2 Cleaning the strings generated by the WPML functions
4.3 Cleaning the strings generated by the Polylang functions
5. Information for the developpers

Only the Administrator can access to the Strings translations.

Go in Languages > Strings translations

The Strings translations list table allows you to translate strings which are generally in the themes and plugins options.  The Strings translations list table displays the strings registered by Polylang and WPML PHP functions and by the wpml-config.xml file.

Note: when you switch from WPML to Polylang thanks to the WPML to Polylang plugin, the strings translations are imported too.

Note: The strings hardcoded in PHP files are not handled by the Strings translations list table. These strings are stored in .po/.mo files and you can translate them with tools like Poedit or the Loco translate plugin.

1. Filter

strings-translation-filter

You can filter the strings translation by the group. By default the filter is on “View all groups”.

WordPress group: Polylang always creates a WordPress group with 4 options: the Site title, the Tagline, the Date Format and the Time format. You can refer to the codex to choose date formats and time formats adapted to your languages.

Widget group: This group appears only once you have setup Widgets . You can translate here all the titles of your Widgets. The text of the Widget Text is also translatable.

Url slugs group: You need Polylang Pro to translate your slugs.

Other groups: Plugins and themes can add their own strings, generally filled by the user in the plugins and theme options.

There is also a search input field which allows you to search for source strings or specific strings names (the search dos not cover the translations).

2. Translate strings

2.1 Create your translations

You first need to fill in the relevant fields in the WordPress, plugins or theme settings the source strings.

Then go in the Languages > Strings translations, translate your strings in the Translations column and then click on “Save changes”. If some languages are missing, make sure that the languages filter displays “Show all languages”.

create-translations-in-strings-translation-table

2.2 Widgets translations

If a widget title is not listed in the strings translations list table, it is most likely because the widget uses the old Widget API (WP < 2.8). Unfortunately, there is no way to make Polylang automatically compatible with all widgets which use this old API.

Widget Text: Appart from the widget titles which should all be listed, only the text of the widgets Text are displayed  in the Strings translation list table, except if other Widgets use the same filter.

Note: remember that when the text of a widget is not translatable, it is still possible to have one widget per language.

3. Translate URL slugs

Polylang Pro offers the possibility to translate the URL slugs for the category base, the tag base, the post formats, the custom post types, the custom taxonomies, the author base… To know more about this functionality, see Translate slugs with Polylang Pro.

4. Cleaning the database

4.1 Cleaning the translations

cleaning-translations

Polylang stores the translations in the database (as post type ‘polylang_mo’ in the ‘wp_posts’ table to be precise). When a theme or a plugin is deactivated, the translations associated to its options are kept in the database, although these translations are not displayed anymore in the list table.

You can permanently delete these translations from your database by checking the “Clean strings translation database” option , and then clicking on “Save Changes”.

4.2 Cleaning the strings generated by the WPML functions

cleaning-wpml-strings

Thanks to the WPML compatibility mode of Polylang, some strings may be registered by the WPML functions, used by the themes and plugins. Unlike strings registered by the native functions of Polylang, and to keep the functionality as close as it is in WPML, these strings are not removed from the list table when the corresponding plugin or theme is deactivated. You can permanently delete them thanks to the delete Bulk Action.

4.3 Cleaning the strings generated by the Polylang functions

cleaning-polylang-strings

The checkbox is greyed for the strings generated by the Polylang functions, or wpml-config.xml files (which may be provided by your theme or plugins). These strings are automatically removed from the list when the corresponding plugin or theme is deactivated (although the translations are kept as explained above).

5. Information for the developpers

There are 3 ways to include strings in the list table, please refer to the documentation for the developpers: ‘pll_register_string’, wpml compatibility mode, wpml-config.xml.