Localizing a theme or a plugin to a language of your choice can be a fairly effortless task even for beginners, provided the right plugin is used for this purpose.
The first and perhaps most obvious option for translating the labels would be the WPML plugin, which is compatible with all our themes; however if you do not wish to use a plugin that requires purchasing, there are other free alternatives which can be pretty useful.
Loco Translate plugin is one that stands out from the crowd; many users are fond of its straightforwardness and the functionalities it offers.
By using this plugin you’ll be able to translate any string in the theme/plugin, including the Widget Area titles – all this directly from your browser, without having to use any extensions or additional software.
This article will guide you through adding the localization to your language into a desired theme or a plugin.
However, you should first get familiar with the most common terms used when translating labels in WordPress themes or plugins.
⋅ Label － A predefined text in a theme, added by the author.
⋅ POT file － Portable Object Template – This is the file that you get when you extract texts from the web/mobile application. Normally, you would send this file to your translators/agency.
⋅ PO file － Portable Object – This is the file that you receive back from the translators. It’s a text file that includes the original texts and the translations.
⋅ MO file － Machine Object – The MO file includes the exact same contents as PO file. The two files differ in their format. While a PO file is a text file and is easy for humans to read, MO files are compiled and are easy for computers to read. Basically, when you deploy your mobile/web application (or build your software) all PO files are converted into MO files, so the application is able to read the file faster and your application stays quick.
Now that you are familiar with the basic terms, you can install and activate the Loco Plugin via your backend.
You should first check if the theme you are using has the POT file in the following location:
There’s no reason to worry if the POT file is not present, since you’ll be able to generate a new template with ease. More on this a bit later on.
Keep in mind that every plugin has its own POT, MO/PO file, so you’re required to search for a desired label within the plugin itself.
After you’ve installed the Loco Translate plugin, you’ll have a new option in the main WordPress menu:
As shown on the image above, you can find the currently selected website language on the Home page of the Loco Template. You can also see the number of active themes and plugins, divided into separate sections.
As you may already know, your website’s default language can be set from Settings > General:
By clicking on the desired theme or plugin, you’ll get the option to add a new localization for that theme/plugin, and to create or modify the existing template within the POT file.
In case you try adding a new language, and there is no POT file (template) for that theme or plugin, you’ll get the following error:
You’ll be able to add a new language by generating a new template, as shown on the image below:
Now you’ll get a list of editable/translatable labels for a theme or plugin of your choice.
After you have located the desired label, all you should do is input the translation into the your-language translation field and save the changes you made.
The pages Themes and Plugins within the Loco Translate menu show all the installed themes and plugins that allow you to translate certain labels, while the page WordPress lets you add the translation for the WordPress Core.
You can check all the added localizations on the Languages page:
If you wish to change some of the default settings for the Loco Translate plugin, you can do so here: