There are thousands of plugins and themes all around the world. You can find them on WordPress.org, Envato, WooThemes, and other marketplaces. If your main language is English, then there’s not any problem with them. You just download the theme/plugin, install it and you are ready to go.
But what if you are Italian? Dutch? Icelandic? Nobody, or at most few developers, develop their plugins and themes in a language different from English.
You will need to translate it, and I’ll explain you how.
There are two ways to do it.
Directly within WordPress by using a localization plugin
Today you will learn how to translate themes and plugin with a WordPress plugin, Loco Translate.
Translating with Loco Translate
First of all, you need to install Loco Translate on your website, and you can do so like you do with any other WordPress plugin. Go to Plugins > Add New, search for Loco Translate in the search field and then click on Install Now when you find it. After installing it, click on Activate.
When you are ready, you will have a new menu item named Loco Translate on the left in your Dashboard. Click on Loco Translate > Manage Translations. You will see a screen like this:
The screenshot above shows a list of themes without any translation included in them. If they already have translations included, they will look like this:
You can now add a new language for your theme/plugin (I’ll show you how to do it for a theme, but for a plugin is exactly the same, just scroll down the list and you will find the Plugins list).
Add a new translation
Click on New language and choose which language you want to add.
The needed language files will be created and you will see a screen like this:
Click on a string in the box Source text to start translating. Type the string’s translation in your language in the box below, named Italian translation (if you are translating in Italian, it will be Dutch translation if you are translating in Dutch, etc.).
When you translated all the strings (or when you are done for the day), click on the button Save on the top to save the current status of the translation. The plugin will save the PO file and will generate a MO file, and your theme/plugin will use that translation from now on.
PO? MO? What are these files?
WordPress uses PO and MO files to manage translations. The reality is that WordPress only needs MO files to manage translations. PO files are human readable translation files, they are those files with a list of strings ready to be translated or with a translation already included. They are those files that Loco Translate uses to show you the strings, like in the screenshot above.
MO files instead are compiled files used by WordPress to get the translation of a string. If you try to open a MO file with a text editor, you won’t understand anything of its content.
I translated a theme/plugin but the translation is not loading/working. Why?
Usually this means that you forgot to save the translated file, or that it’s in the wrong path. Usually plugins and themes search for translations in the folder /languages or /i18n inside their root, but this may change. Also some of them load their language files from the path /wp-content/languages/ which is the default WordPress languages root. If they do, put your MO file in there because it will be update safe.
I updated my theme/plugin and I lost my translation. How can I recover it?
I’m afraid you can’t unless you saved a PO/MO file somewhere on your computer. Some themes/plugins allow you to put translations in the folder /wp-content/languages/ which is the main languages folder used by WordPress. That folder is update safe and your translations won’t be lost while updating. If your theme/plugin does not allow it, contact its author and ask him to include that path in the code of the plugin/theme.
Some strings are translated in Loco Translate, but they are not loading, why?
Be sure that they are not Fuzzy. A Fuzzy string means that it needs to be checked. The translator was probably not sure of his translation, so marked it as Fuzzy to let others confirm that the translation is correct before to use it.
In some cases, like while using WooCommerce, it could mean that your theme is overriding the plugin templates. Or it could also mean that there’s an error in the code.
Help the community
If you translated a theme/plugin, you can give a huge help to the community by sharing your translation. Don’t keep it only for you, send it to the theme/plugin author and ask him to include it in the next release so also other people who speak your language can use it.
https://cache.nicola.blog/wp-content/uploads/2015/09/translate-loco-translate.jpg354825Nicola MustoneNicola Mustone2015-09-02 08:55:542015-09-07 08:22:09How to translate WordPress themes and plugins with Loco Translate