neon sign displaying the word world

Enough is enough! You need that plugin to speak the language of your customers! You want to translate a WordPress plugin. However, you’re not a developer.

How can you help developers translate a WordPress plugin into another language? After all, WordPress is the most used content management system out there. So, it makes a lot sense to include other languages.

Reasons to Translate a WordPress Plugin

The sheer number of users motivated the development of the free StockUnlocks plugin to unlock phones for the WordPress community.

The StockUnlocks module for Drupal was our first effort to automate the process of retrieving cell phone unlock codes from various Dhru Fusion direct source suppliers. At any rate, the StockUnlocks module had many downloads and enjoyed limited success.

Drupal has a large, diverse and well respected user base. However, there was always this feeling that even more home based phone unlocking businesses would benefit if they had a WordPress plugin.

Releasing the StockUnlocks plugin for WordPress immediately put us in front of a larger community of users. Thus, greater exposure leads to more and varied feedback.

It didn’t take long before we received requests to have portions of the plugin translated into the language spoken by the majority of visitors to sites using the StockUnlocks plugin.

Some of these language translation requests were specific to the instructions appearing on the WooCommerce Product when ordering a phone unlock service. When viewing the product, here’s a portion of what the customers see:woocommerce remote unlock service product displayedSince the translation requests didn’t involve translating the entire plugin, we decided to take on the task and learn more about WordPress plugin language translation.

Isolate and Translate the Word Phrases

At first, we identified the word phrases to translate. Here’s what we came up with:

  • Total digits
  • to display dial
  • Bulk Submit: One Per Line
  • Response Email
  • Add to your address book
  • Confirm Email

After that, we decided to go with something called a gettext translation app. We use the Poedit app, a free translation app for both Mac and Windows. Poedit allowed us to create a .pot file for a specific language. The file is only a template. Therefore, it outlines the words to translate for the plugin.

If you’d like to see the .pot file used for the StockUnlocks plugin, you can find it by locating the following directory:

/wp-content/plugins/stockunlocks/languages/stockunlocks.pot

The stockunlocks.pot is the translation template file. This file is required in order to translate a WordPress plugin.

Once you have access to this .pot file, you’re on your way to translating the StockUnlocks plugin into whatever language that you want.

Files with the .po extension represent the translated languages. So, any files with the .mo extension are special files that are generated by the Poedit app.

Here’s an example of the files that you may see:

  • stockunlocks-sv_SE.mo
  • stockunlocks-sv_SE.po
  • stockunlocks.pot

These .mo and .po files represent the Swedish language translation.

If you were to open the .po file with a standard text editor, you will find lots of text with descriptors that may be confusing. The most important sections contain the following lines (Swedish language) :

-------------------------------
msgid "Total digits"
msgstr "Totalt antal siffror"

msgid "to display dial"
msgstr "att Visa ratten"

msgid "Bulk Submit: One Per Line"
msgstr "Bulk Submit: En per rad"

msgid "Response Email"
msgstr "Svar e-post"

msgid "Add to your address book"
msgstr "Lägg till oss i din adressbok"

msgid "Confirm Email"
msgstr "Bekräfta e-postadress"
-------------------------------
  • msgid refers to the original English text. The source language.
  • msgstr refers to the target language.

Creating Your Language Translation Files

If you want to create your own translation files for StockUnlocks, you will need to:

  • Access .pot file found in: /wp-content/plugins/stockunlocks/languages/
  • Download and install Poedit
  • Open Poedit and select the ‘Create new translation’ option

poedit launch screen create new translationpoedit dialog to select file to translate a wordpress pluginPoedit will now direct you to select a POT file. Select the StockUnlocks .pot file. Then you will prompted to select the language of the translation.

poedit dialog translation language file selectionAll you have to do now is select the language from the drop-down list or start typing the language name and then click OK.

poedit interface source text and translation dialogThe translation interface will appear, displaying the list of strings available for translation. At this point, just click on a string to select it and then enter your translation.

Use Poedit and Submit your WordPress Plugin Translations

After you’ve finished translating, you need to save and export your work. Go to “File > Save” and name your translation file.

Afterwards, you have to name the file based on the language name and the country code for that language. For example:

  • sv_SE for Swedish and Sweden
  • en_GB for English and Great Britain
  • fr_FR for French and France

Poedit takes care of saving your translation in the .po and .mo files that were described earlier. Also, these are the files that should be placed in the plugin’s languages directory if you want to start using them right away.

If you’d like for us to include your language files in a future version of the StockUnlocks plugin for WordPress, just contact us to send us your.mo and .po files.

We know that we’ve only scratched the surface regarding how to help translate a WordPress plugin. Our goal is to be able to provide a version of the StockUnlocks plugin that can be fully translated into any language.

In the meantime, what else would you like to see translated in the StockUnlocks plugin?

Let us know what you think!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.