Select Page

If you created a site in WordPress and added more languages using Polylang, you should now translate all the strings (words) that Polylang did not automatically register to be translated. Depending on how your theme is well made, Polylang does not register all words automatically.

In order to get it all right, this procedure consists of the following steps:

  1. Register strings in Strings translations
  2. Insert translation for registered strings
  3. How to make Polylang clear what words should translate based on registered strings

Registration of new strings in Polylang

In order for Polylang to know what to translate, it is necessary to register the words that need to be translated. Polylang, by default, withdraws all the words that it believes should be translated and placed in Strings Translations. However, the problem is the words that Polylang does not see as the words to be translated.

Here is an example of the words that I added in Strings Translations, which Polylang did not immediately withdraw, can be seen to be important words that should also be translated:

Here’s what you need to do. Find the string that you need to be registered. I need to register Sign Out, so I went to header.php (file in the theme) and found the row containing:

<?php _e('Sign Out', 'child9'); ?>

Therefore, you need to register Sign Out. When you find out, go to functions.php (file in the theme) and add the following line to the bottom:

pll_register_string('child9', 'Sign Out', 'true');

From that moment, the Sign Out string is located in Strings Translations and you can add translations for the languages that you have set up in Polylang.

Insert translation for registered strings

Go to Strings Translations and add translations for the new string:

Quite simply, but that’s not enough. Now we have made Polylang aware of what the words should offer the translation we have inserted, but Polylang still does not know where to show these words. You need to do the following.

Calling for translated strings

Return to the header.php file and replace:

<?php _e('Sign Out', 'child9'); ?>

Instead, place:

<?php echo pll_e('Sign Out')?>

And that is that. Now you have informed Polylang that the Sign Out option should change depending on the language that is selected on the site.

This procedure should be repeated for each word-string to be translated. Keep in mind that strings are in different theme files, and all the strings can be registered through the functions.php file.

I tried the plugins that should save time

I tried two and none worked, i.e. No string was registered automatically. I found three instructions from developers explaining what needs to be done, but I did not succeed because the instructions were written with programmer jargon. In the end, I dug up where and what to put in order to do everything properly. And I wrote it down here.