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.