Translating The Plugin (Localization)
Documentation, Reference Materials and Tutorials
We provides you a very simple method for translating the plugin into your own language by letting you create your own translation files and then placing them in an upgrade-safe directory. This short guide will show you how to use your own translations.
Before you begin
Your plugin includes a language file (.po or .pot file) which contains all of the English text. You can find this language file inside the plugin folder in your-plugin-name/languages/.
Set up WordPress
WordPress needs to be told which language it should run under.
- Go to: Dashboard > Settings > General and change the Site language.
Once this has been done, the shop will be displayed in your locale if the language file exists. Otherwise you need to create the language files (process explained below).
Translating with Loco Translate
Loco Translate is the another plugin for translation, which allows you to translate the plugin directly in the WP admin panel.
Loco Translate is a free plugin that you can download here. You can also add directly from the WordPress administration, in Plugins > Add New.
Once you installed and activated Loco Translate, a new "Loco Translate" menu item is created with two sub-sections. By default the "Manage Translations" section will list all your themes and plugins and will display all available translations for each of them:
You can easily add new languages to a theme or a plugin using the Add New Language link:
Then choose the language to add in the list, or enter the language ISO code (ex: fr_FR, en_US etc...), and select the folder to add the translation files to, and hit Start Translating:
If you do not get string listing as mentioned below, then click on "sync" button first to get all string listing and Finally start translating and save when you finish.
Translating with PoEdit
PoEdit is a more advanced alternative to Loco Translate and Codestyling Localization. Only advanced users or translators who wish to contribute to Your plugin core should attempt this method.
Your plugin comes with 1 .PO file which can be imported into PoEdit to translate.
- plugin-textdomain-en_US.po – Contains all translation strings
To get started open PoEdit and go to File > New catalog from POT file. Once you have done this, choose plugin-textdomain-en_US.po file and PoEdit will show the catalog window:
Enter your name etc so other translators know who you are and click 'ok'. After this you will be prompted to save your .po file – name it based on what you are translating to, for example, a GB translation would be saved as plugin-textdomain-en_GB.po . Now the strings will be listed.
After translating all strings you can save - the .mo file will also be generated automatically.
Updating your translation
After updates, you can update your po file by opening it and then going to Catalog > Update from POT file. Choose the file and it will be updated accordingly.
Making your Localization upgrade safe
If you keep your custom translations in your-plugin-name/languages they can be lost when upgrading. To make them upgrade safe, instead place them in wp-content/languages/your-plugin-name/.
Can't find the answer you are looking for?
If you have any questions that are which are not listed in documentation, Feel free to get in touch with us on firstname.lastname@example.org