How to properly translate WordPress theme?

March 1, 2018 no comments Alex Categories Getting StartedTags , ,

According to WordPress standards every hardcoded string in a theme should be translatable and located in a so called POT file, example: wp-content/themes/themename/languages/themename.pot. The same concept is applied to all WordPress plugins including those that may come in one purchase package with a theme, example: wp-content/plugins/pluginname/languages/pluginname.potThere are various options how to modify POT files. The recommended way is by using a plugin. The image below illustrates different solutions that are available for download for free directly from plugins section of your admin panel.

WordPress theme localization. List of popular plugins from admin panel.

Loco Translate is a recommended plugin for your website localization. Its free of charge and it grants access to all files that are related to translation both for themes and plugins. Just type Loco Translate in the search bar click on Install Now and then Activate buttons. Once Loco Translate plugin is installed a new section named Loco Translate will show up under WordPress admin panel. See the image below.

Loco Translate admin panel, dashboard. List of themes and plugins.

If you are using one of Kenzap themes most of the translatable strings will be located in theme file. If a Child theme is activated and there are no translation strings you may need to refer to the parent theme instead. In order to do this click on See all themes then select same theme name but without Child word in title. Example, switch translation from Madang Child Theme to Madang Theme. Click on Theme name > New language > Choose Language to create first translation. Now find the strings you want to translate and write translation in a place as highlighted in the image below.

WordPress Loco Translate String Localization Example

Do not forget to translate plugins as well as some string duplicates exist and they may overlap in different locations of your website. Once all the required strings are translated you may need to change your website locale. If not yet done go to Settings > General > Site Language to change default language of your website. The language selected should match with the language translation made from Loco Translate section. By default WordPress does not come with all languages preinstalled. If you are having difficulties finding your locale please refer Translating WordPress.

This article does not cover all localization options that might be useful for you. If you want to support multiple languages under your WordPress website we recommend you to read Multilingual WordPress article. If you want to use automated translation solutions please refer to GTranslate plugin page.