How to Add Plugin Localization
It’s quite a common situation when you change your WordPress-based website language to another one, however, some the texts on the website remain in the previous language, usually in English.
This article will explain how to avoid this by adding the localization (translation) of the plugin.
In case you already created a localization for your theme files as well as content is translated, WordPress may still pull some of the website texts from the files of one of the plugins you may be running on your website.
To deal with that, first, you need to identify which plugin is going to be localized. Once you did that, you are ready to create a localization for your plugin. You can use the POedit tool for that purpose, which can be downloaded here.
- After the installation of this software to your computer, navigate to the wp-content/plugins directory of your website via the FTP client or the hosting server file manager. There you will see the plugins’ folders. Each of the plugins’ folders contains languages folder, which in its turn contains a blank .pot file which you should use to create a plugin’s localization.
- In order to do that, download the .pot file to your machine and open it with a POedit tool.
- In the Translation language dialogue box select the language you are going to add.
- After this is done, you can start working with the strings you need to be translated. Also, POedit will suggest you the most common translations for each string so the process will be relatively easy.
- Next, go to File > Save menu or press Ctrl + S hotkeys and save the localization. You’ll get two files with the *.po and *.mo extensions. You need to name them as plugin_name-ln_LN, where ln_LN is the locale (international code of the language) and plugin_name is the name of the plugin you’re making translations for. For example, if we translate WooCommerce plugin into Spanish, the files names would be woocommerce-es_ES.po and woocommerce-es_ES.mo.
- Then upload these two files to the wp-content/languages/plugins folder. If such directory doesn’t exist, simply create it.
- The last step would be to ensure you have the proper language set as your website language. You can do this in Settings > General section of your WordPress Dashboard.