This is a short tutorial with screenshots showing how a user can translate a WordPress or bbPress plugin (which has a POT file, most generally do) in his or her own language. Here, I have taken my bbPress plugin After the Deadline as an example to show how to translate with a software named Poedit. I have chosen Poedit because it has a very simple user interface, and is very easy to use.
Here are the steps:
- Download and install Poedit.
- Open it. Go to File -> New Catalog from POT file
- Select the POT file. It is generally in the root, languages or translations directory of the plugin.
- Enter the settings in the dialog box shown.
- Enter the path, which is in the same dialog box. Path is the place where is the plugin stored on your local hard disk. In my case it is F:\after-the-deadline.
- Write your translations. Here I have translated the plugin into the language hindi.Note: Be careful with the php values, such as %s, %1$s etc. Always include them in the translated string, and in the same order if it is %s and doesn’t include a $ sign! See the screenshot above for an example. Notice that %s is included in both strings.
- Save your PO file in the same directory where the POT is stored. Name it as languagecode_COUNTRYCODE. For eg. hi_IN (Hindi is the language and India is the country).
- A .mo file would also have been generated. Now notice that my POT’s name is after-the-deadline and my PO’s name is hi_IN. Now you have to rename the .mo file to POT-PO.mo. In my case, the resulted file would be after-the-deadline-hi_IN.mo. You can do the same with the PO file too, if you wish, but it is not necessary.
You have successfully translated the plugin, congrats! If you have translated any of my plugins, please contact me so that I can include the language files in my plugin. If you have any queries, ask them below!