We’ve all heard the statistic that WordPress now powers over 33% of websites, but how can you ensure your plugin or theme can be used as widely as possible within the ecosystem?
Surprisingly enough, less than half of all WordPress sites have their locale set to English! If you don’t have translations set up already, that means more than 50% of your potential customers probably can’t work with your product in the language they best understand.
One of the best ways to open up your product to the world is by creating high quality translations of all user-facing text, but the problem is that translation takes a lot of time (the more text you have throughout your product, the more strings to translate). Translation also requires proficiency in different languages, knowledge of how to manage MO and PO files, and overall – a whole lot of effort.
My name is Diego Imbriani, and I’m a plugin developer since 2011, I’ve been selling my plugins through my company GreenTreeLabs and my products are currently active on ~70,000 websites world wide.
Thankfully, I found a way to help alleviate the whole translation process and make translating plugins and themes a whole lot easier.
I recently wanted to add an Italian translation to one of my plugins: Final Tiles Gallery for WordPress, so I opened the plugin’s PO file, which contains all translatable strings, and I started to translate my plugin line by line.
An extract from the Italian PO file of Final Tiles Gallery
The PO file of Final Tiles Gallery has about 350 entries and translating them all requires about 2 hours and – honestly – I don’t find this job very appealing. As I was digging through the translations, I wondered if there existed a way to automatically translate my PO file…
I decided to experiment a little with the Google Translate API and manage to code a script to accomplish this exact task! Below, I’ll walk you step-by-step, showing you how you can use the script I created to automatically translate your WordPress plugins or themes.
WordPress and Languages
I must admit I’ve never been very worried about translating my plugins. I’m Italian, but I always used programs and operating systems in English. It feels “weird” to use any kind of user interface that’s not in English. Maybe that’s just me 🙂
WordPress is used by millions of people of any background, language, and culture – from all over the world. We simply can’t ignore translating our plugins and themes.
WordPress is used by millions of people of any background, language, and culture – from any part of the world. We simply can’t ignore translating our plugins and themes.Tweet
I sell my plugins using Freemius, which has a nifty dashboard with extremely useful analytics and stats. A few days ago, I had a look at the “Top 10 Languages” table that you find in their Developer Dashboard, and although I know that many of the sites where Final Tiles Gallery is installed are not in English, I was very surprised to find that on a sample of about 25,000 installations, less than 50% of websites are in English! Here’s the overview:
As you can see, French, German and Russian make a large percentage of users with almost 20% in total.
Benefits of Translating a Plugin or Theme
For WordPress plugin or theme businesses, translating our products is also a marketing opportunity for many reasons:
Not all WordPress users are willing to install a plugin that doesn’t have a translation in their language. That could be for many reasons, but mainly because they probably don’t understand English.
In other cases, users may understand English, but simply prefer their own language. So, given the choice between two similar plugins, those customers would pick the one in their language, even if the other plugin was a little better.
It can also be related to cultural reasons. As an example, for historical reasons, especially the older generation of French people don’t like the English language. If you google “why french hate english” you’ll find dozens of articles about the topic. Moreover, only about 40% of French actually speak the language. So if your product isn’t translated to French you immediately lose 60% of the French WordPress market-share. And if there’s a French alternative to your product, you probably lose them all, or at least the vast majority. Similar analysis are relevant to many Asian countries like Japan that are not yet “Americanized”.
Vova Feldman, Freemius CEO, has written a bit about the benefits of translation for SEO on the WordPress.org repository, but it can’t be emphasized enough. The fact is the search algorithm on the repo is highly sensitive to the use of different languages in your readme.txt.
Focusing your translation efforts not only on your product strings but also on your readme.txt can compound your marketing reach on the repo. While most users are searching in English, it’s clear based on the locale stats from WordPress.org mentioned above that there are many users who don’t search in English, and therefore have only limited access to many of the plugins and themes available to those who understand English.
The algorithm gives different results based on the locale of a given WordPress installation – translating your product overcomes this barrier to getting exposure to users you normally would never be able to reach.
Vova put it very well when he said, “Bottom line – translations are now more important than ever!” – and it’s still true more than a year on.
Translating your plugin or theme has some positive psychological implications for your customer. A plugin or theme that offers translations in your customers’ own language can be perceived as a higher quality product. It means the developer invested time on more than just technical issues. Customers will recognize this value and hopefully therefore see the quality of your product in a different way.
A plugin or a theme that offers a translation in your own language can be perceived as a high-quality product. It means the developer took care to spend time on more than just technical issues.Tweet
Adding translations to your plugin or theme can create a knock-on effect of voluntary translators on the WordPress.org repository if you offer a free plugin or theme. A plugin that even only have a few languages translated is perceived as being much more popular than a plugin with no translations at all, so volunteers may be more inclined to contribute.
List of some translations stats for the Gutenberg plugin
So now that we understand the benefits of translating our products, the next question is: How many languages should we support?
Choosing Supported Languages
Let’s start by saying there’s no limit to how many languages you can support. But, we need to consider a few things before just translating your plugin or theme into all of them.
The problem is that if you translate every language using Google Translate, there will inevitably be incorrect translations. The resulting issue is that you may get user feedback about incorrect translations in your plugin or theme.
In order to resolve this problem, I suggest starting with the most popular languages, and this type of data can be obtained from 3 places. The first is the Freemius Developer Dashboard, as mentioned above. If you don’t use Freemius, another useful option is the WordPress.org stats page that shows the most popular WordPress locales. Another solid option would be looking at the Google Analytics stats for your product’s website.
Subscribe and grab a free copy of our
WordPress Plugin Business Book
Exactly how to create a prosperous WordPress plugin business in the subscription economy.
Share with a friend
Enter your friend's email address. We'll only email them this book, scout's honor.
Thank you for sharing
Awesome - a copy of 'The WordPress Plugin Business Book' was just sent to . Want to help us spread the word even more? Go on, share the book with your friends and colleagues.
Thanks for subscribing!
- we just sent your copy of 'The WordPress Plugin Business Book' to .
Have a typo in your email? click here to edit the email address and send again.
Wherever the numbers point, you can choose to go with the languages that have the largest audiences. If you offer a few translations to those audiences first, you can ask some of your customers or colleagues to review the translations before you release them publicly, so you’re not overwhelmed with feedback from customers about minor translation issues. Fiverr also has tons of professionals who can help confirm your translations.You can further minimize your support load by adding a notification in your plugin or theme’s WP Admin settings to inform users to suggest translation updates on the WordPress.org repository instead of submitting a support ticket.
Following this step-by-step process for each language is a logical way to proceed so you can achieve high quality translations and prevent your support queue from overflowing with tons of small tickets.
Using the Google Translate API to Translate Your Plugin/Theme
Google Cloud provides an API so that you can use Translate as a service.
Google Translate API Pricing
Version 3 of the API is free until 500,000 characters per month, and $20 per million characters if you exceed the quota. You can read pricing details here.
Google Translate API pricing (May 2019)
A Quick Side Note – Internationalized
All plugins must be internationalized before being localized. A great place to start is the WordPress.org guide I18n for WordPress Developers that explains the steps. Once you’ve created your .pot/.po files, you can proceed on the scripting process below.
All plugins must be internationalized before being localized. A great place to start is the WordPress.org guide I18n for WordPress Developers that explains the steps.Tweet
Before we can run the script we need to create a new project in Google Cloud console. If you need help with this task, check this guide or follow these steps:
- Go to https://console.developers.google.com and login.
- Click “No organization” or select your preferred organization (we assume you don’t have one):
3. Click “New project”:
4. Enter a project name and click “Create”:
5. Now you should be redirected to the Console dashboard. Click “Enable APIs and services”:
6. Search for the “Cloud Translation API”:
7. Click “Enable”:
Now that we have a project, we need to set up a service account to authorize our requests to Google APIs. You can follow steps 1 and 2 on this guide from the Google Cloud platform otherwise follow these steps:
- Go to “Service accounts” section from the main menu: “IAM & Admin”:
2. Click on “Create service account”:
3. Enter a name and a description for the service account and click “Create”:
4. Click “Continue” to skip role selection as we don’t need it:
5. Now click “Create key” and then click “Create”, make sure you selected the JSON format:
6. After you create the key, the browser will download it automatically. Remember the folder where you’re going to save the file as we’ll need it later.
Now it’s all ready to go but before running the script be sure you have set the GOOGLE_APPLICATION_CREDENTIALS environment variable as described in the guide:
Example: Linux or macOS
Replace [PATH] with the file path of the JSON file that contains your service account key.
Replace [PATH] with the file path of the JSON file that contains your service account key, and [FILE_NAME] with the filename.
With command prompt:
Now that we are done with the boring stuff, we can start translating!
- Clone the repository from https://github.com/GreenTreeLabs/po-gtranslator
- Open up your command line and run the following command:
- Git clone https://github.com/GreenTreeLabs/po-gtranslator.git
- If you don’t have git installed you can download it here.
- Enter the directory po-translator:
- Install the dependencies:
- In case you don’t have the npm utility be sure to install Node.js from here.
- Run the script with all the needed parameters:
node po-gtranslator.js --project_id=final-tiles-gallery --po_source=it.po --po_dest=it_IT.po --mo=it.mo --lang=it
Let’s have a look at each parameter:
--project_id: ID of your Google project, you can get it from the Google Cloud Console
--po_source: path of the empty PO file that you want to translate
--po_dest: path of the PO file with the translations
--mo: path of the MO file
--lang: code of the language you want to translate to
Note that the source PO file will be kept untranslated and it can be used to generate as many languages as you need. The PO file you need to add to your plugin or theme is the one you pass as –po_dest, which is unique for each language.
po-gtranslator.js in action!
Thanks for scripting with me!
It’s been a fun learning experience for me to figure this process out, and I hope it helps you in your translation endeavors. Get in touch with me @GreenTreeLabs or comment below with any questions or feedback.
The worst idea to give to a dev as any Google translations will be rejected by most of WordPress.org GTEs or PTEs. It’s just a waste of time and money.
If you need to get your plugins/themes translated you should better ask and invest in dedicated companies, like WP-Translations 😉
Thanks for your feedback. I actually have published my translations and none has been rejected. If we want to discuss about the quality of an automatic translation VS a human one, clearly no doubt the latter wins but this is clearly stated in my article 😉
I think that there are two different cases :
– When you are the developer of a plugin, there is no review from WP teams to check your translations, you can put whatever you want.
– When you want to contribute for a plugins translation, you can submit it, but WP team will check it and take a moment before validate it.
I’ve tested both, that’s why I say that.
Thank you Diego for sharing this article. Nicely explained with detail steps for translation endeavors.
Diego, such a detailed article. Till date, I haven’t think about the translations of the themes and plug-ins. Thanks, Benard for sharing us about WP-Translations.
Thanks for sharing nice post to translate WordPress plugins with Google translate. These tips will help me to translate themes and plugins. I am sharing some valuable tips to improve website speed in 2019: https://www.techmagnate.com/blog/how-improve-web-page-speed/
How do you handle translations if you’re using Freemius to generate a free version AND a premium version of your plugin? The .POT file for the free version will contain references to text that does not exist, and the line numbers will be wrong.
Hey Chris, sorry for the very late response. The free version contains also the strings contained the premium version so not really the best solution, however you can run the script twice, one for the free version and another for the premium one.
It’s really great IDEA. I’ve been struggling for Translation issue a lot. Now, it seems you’ve made my job easier.
How do you handle translations if you’re using Freemius to generate a free version AND a premium version of your plugin?
You can run the script twice, one for the free version and another for the premium one.
Thank you i translated my https://wordpress.org/plugins/cf7-styler/ Plugin with free and well supported plugin:
My questions is how to upload the mo. / .po files into WP translation area so others can contribute too?
Only translate the plugin and add mo. / .po files to the plugin folder would not do the trick.
According to https://make.wordpress.org/meta/handbook/documentation/translations/ WP’s system imported po/mo files once, but not repeatedly.
So translations contributors would need to submit their translations to you, the plugin author, directly for merging into your repo.
Thanks a bunch for this. I needed to translate a theme, and really didn’t want to do it all by hand. This is a fantastic time saver. all that will be left when the file finishes processing will be to check and trim, and that would be it.
Thank you 🙂
This is a great tutorial! I completed all the steps you described succesfully and I triple-checked them. When I run the script, it throws the error message below at me. The .json file is definitely in the right spot; I also tried moving it to an other folder and even another disk, but that didn’t solve the issue.
Do you have any idea of what I’m doing wrong and how to solve that?
C:\Users\Harold Kip\po-gtranslator>node po-gtranslator.js –project_id=MY-PROJECT-ID –po_source=D:\Downloads\en_EN.po –po_dest=D:\Downloads\nl_NL.po –mo=D:\Downloads\en_EN.mo –lang=nl
(node:3480) UnhandledPromiseRejectionWarning: Error: The file at “C:\Users\Harold Kip\po-gtranslator\MY-PO-TRANSLATE-FILE.json” does not exist, or it is not a file. ENOENT: no such file or directory, lstat ‘C:\Users\Harold Kip\po-gtranslator\”C:’
at Object.realpathSync (fs.js:1539:7)
at GoogleAuth._getApplicationCredentialsFromFilePath (C:\Users\Harold Kip\po-gtranslator\node_modules\google-auth-library\build\src\auth\googleauth.js:250:27)
at GoogleAuth._tryGetApplicationCredentialsFromEnvironmentVariable (C:\Users\Harold Kip\po-gtranslator\node_modules\google-auth-library\build\src\auth\googleauth.js:192:25)
at GoogleAuth.getApplicationDefaultAsync (C:\Users\Harold Kip\po-gtranslator\node_modules\google-auth-library\build\src\auth\googleauth.js:130:33)
at GoogleAuth.getClient (C:\Users\Harold Kip\po-gtranslator\node_modules\google-auth-library\build\src\auth\googleauth.js:502:28)
at GoogleAuth.authorizeRequest (C:\Users\Harold Kip\po-gtranslator\node_modules\google-auth-library\build\src\auth\googleauth.js:543:35)
at Translate.makeAuthenticatedRequest (C:\Users\Harold Kip\po-gtranslator\node_modules\@google-cloud\common\build\src\util.js:377:28)
at Translate.request_ (C:\Users\Harold Kip\po-gtranslator\node_modules\@google-cloud\common\build\src\service.js:129:18)
at Translate.request (C:\Users\Harold Kip\po-gtranslator\node_modules\@google-cloud\common\build\src\service.js:140:36)
at Translate.request (C:\Users\Harold Kip\po-gtranslator\node_modules\@google-cloud\translate\build\src\v2\index.js:439:19)
(node:3480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `–unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Nevermind. I found another solution.
Could you please name it?
Thanks in advance.
Is there a place where I can translate a plugin into my native language in exchange for translation of my plugin?
Thanks for sharing this!
Admittedly I got started on this, but somehow learned PoEdit Pro also does this, so coughed up some money to buy it and saved myself a bit of time.
Thanks for sharing PoEdit Pro. Were the translations accepted at the WordPress plugin directory?
Hi Anindya, I paid for the version of PoEdit that gets the automatic translations via Microsoft. I’d guess about 1/4 of the translations should be fixed: they either don’t use WP jargon correctly (eg posts) or simply don’t make much sense.
Regards to accepting them to the WP plugin directory’s translations: I don’t know how to submit a .po file to WordPress.org’s GlotPress. Like I commented earlier, as I understand it, the WP.org team only imported a plugin’s .po files once when they started GlotPress, but haven’t imported them since.
So I include my .po files in my plugin, so users of those languages use them just fine, but my plugin doesn’t appear as translated on WP.org.
Thanks for the reply. In order to achieve the benefits of SEO at the WP plugin directory, we need to submit the translation at GlotPress. It’ll appear as translated if they accept it.
To submit a .po file to WordPress.org’s GlotPress please log in and go to this link: https://translate.wordpress.org/projects/wp-plugins/hello-dolly/
Just replace ‘hello-dolly’ with your plugin’s Text Domain.
Then click the relevant language’s Development, Development Readme, Stable and Stable Readme link and click ‘Import Translations’ (at the bottom of the next page).
Please share your experience, if you submit the translations.
oh nice! I did not see that “import” (or export) option at the bottom of the page. Thanks Anindya!
I’ll try submitting them but given how slow manual translations have taken to get accepted to GlotPress (for my plugin, many of the translations have sat unapproved for years), I don’t have great expectations. But we’ll see!