Home » Tutorials » How to translate WordPress themes and plugins

This guide teaches WordPress developers how to efficiently translate their themes and plugins.

WordPress powers sites from all over the world. In order for themes and plugins to be popular, they need to be available in the Web’s most popular languages. ICanLocalize offer expert human translation, with a process that’s optimized for WordPress.

Making Your Code Translation-Ready

First, you need to prepare your code for localization. All the texts in your code have to be wrapped in GetText calls. If you’re new to this, see the WPML FAQ about GetText.

Besides simply wrapping texts in GetText calls, be sure to use placeholders and to never break sentences into multiple strings.

“This page has 7 comments and 13 shares.”

Wrong way Right way
<?php printf( __( ‘This page has ‘, ‘theme-text-domain’ ) . $comment_count . __( ‘ comments and ‘, ‘theme-text-domain’ ) . $share_count . __( ‘ shares.’, ‘theme-text-domain’ ) ); ?> <?php printf( __( ‘This page has %1$d comments and %2$d shares.’, ‘theme-text-domain’ ), $comment_count, $share_count ); ?>
The sentence is made up of several parts, connected with a “.” operator. Translators control the text, but not the order. The sentence comes from one translatable string with arguments. Translators control both the text and the order.

When you do it correctly, the translators can edit the entire sentence and reorder the arguments. When you use string concatenation, the order of the sentence parts is fixed and translators can only translate inside each part. This will lead to bad translation in many languages.

Test that Everything is Translatable

Before you start translating your theme, it’s a good idea to check that everything your theme produces is translatable. WPML can help you do this with the help of the Multilingual Tool Plugin. This tool will produce dummy translations for all the content of a (test) site, including the strings. After you run it, you will easily see which texts are not translatable and fix the code that produces them.

Producing .po Files for Your Themes and Plugins

Once you know that every text coming from your code is translatable, it’s time to start the translation process.

WPML can produce .po files for you. Install WPML on a test site which has your code. Then, go to WPML->String translation. Scroll down to bottom and look for the box “Export strings into .po/.pot file”. Select the textdomain and export the strings to a file.

Setting up a Translation Project in ICanLocalize

ICanLocalize will help you translate the .po files to all the languages you need. When it’s done, you will receive both translated .po files and .mo files. You will be able to share and reuse translations between your different products, translate only new and modified texts, get reviews inside WordPress and more.

Let’s get started.

  1. First, create an account. You will receive a confirmation email. Click on it and your account is ready.
  2. After you confirm your email and log-in, click to start a new Software project.
  3. When you create the project, be very specific in the description field. This is where you want to tell the translators what work you’ll need from them. You can use this template and fill in the blanks:

    This .po file includes the texts for the THEME/PLUGIN called NAME. You can read about it here:
    LINK

     

    My product works inside of WordPress. To translate it correctly, you need to be familiar with WordPress and know the WordPress terminology in both English and in your language. Translations must be consistent with WordPress naming.

     

    Our audience is …

     

    Translation needs to be CASUAL/FORMAL.

     

    Before you translate, you will need to see how our product works in WordPress. Here are screenshots that show you what you are translating:

     

    PAGE WITH SCREENSHOTS AND EXPLANATIONS

     

    After you finish translation, I will create a test site which will work in your language. You will need to check that all the translations make sense and that they appear correctly.

  4. Scroll to Upload the resource file to translate
  5. Select the .po file that you generated, choose the file format as ‘po’ and click to upload.
  6. Review the strings and add to the project. This review page helps you make sure that the strings are all good. If you find problematic strings, cancel, edit your code and generate a new .po file.
  7. If you already have previous (even partial) translation for your project, you can upload it. Please be sure to upload translations that you are completely certain about. Otherwise, you could be mixing between inaccurate translations and professional translation. This might confuse ICanLocalize translators and cause them to use wrong wording for your project.
  8. Translators will apply to your project. Give them a couple of days to apply and present themselves. In ICanLocalize, you choose your own translators. All translators in ICanLocalize are professionals and write in their native language. The ability to choose translators yourself allows you to find translators who know the subject of your project.
  9. Accept the applications that you like best. You only need one translator per language. ICanLocalize system automatically assigns reviewers.
  10. You will get a quote from ICanLocalize for the total cost of your translation project. Before you deposit the payment, you see exactly how much the work costs and a breakdown per language.
  11. Deposit the payment for the work and the translators will get started.

How to Get and Test Your New Translations

When translations complete, ICanLocalize system will send you notifications. You will receive separate notifications whenever each language completes.

Go back to your project, scroll down to the section called “Uploaded resource files” and click the button “Create translations”. ICanLocalize system will compile .po and .mo files with your translations. You can download one ZIP file which includes all the translated files.

Add them to your theme or plugin and be sure to load them using load_theme_textdomain or load_plugin_textdomain. Change the language of the site and see that translations appear. If you’re using WPML on that site, go to User->Profile and set the user language there.

Prepare Review Sites for Your Translators

Once you see the translations in WordPress, you need to allow the translators to review as well. The best way is for you to create an online test site, which the translators can access. You can create one site, install WPML and create user accounts for the translators and reviewers.

To send messages to the translators, go to the project in ICanLocalize, scroll to Translation Languages and click on the links “Communicate with…”. There’s such link next to each of the translators you’ve selected.

Give the login details for each of the translators and explain to them how they can switch the language of the site (under User->Profile). It’s important that the translators will first review the English and then their translation, to make sure they understand the full context of everything. Remind them which URLs they need to visit and what they need to click on. Since you’re sending these instructions to a number of translators, we recommend that you create a short document with “review instructions”. You can upload this document to the chat with each of the translators. You can also broadcast a message to all translators.

How to Handle Issues with Translations

ICanLocalize has an issue tracking system, which allows you, the translators and reviewers to communicate, track and resolve issues.

When translators need clarifications (and good translators will almost always need that), they will open ‘issues’ for you. You will receive a notification email. Try to respond to these emails as soon as you can, so that translation doesn’t lose it momentum.

If you notice anything that the translators should change, you can create issues yourself.

How to Update the Translations when the Theme/Plugin Updates

Every theme or plugin receives updates. Some of these updates also include new and modified texts.

When you’re done developing, but before you release you do a “strings freeze”. This means that you’re done updating texts. You may be doing last tests, but the texts are final. This is the time to update the translations.

Go to your project, scroll down again to the Resource files section and upload the new .po files for the new version. Select the option “Ignore duplicate strings” and ICanLocalize system will identify the new strings. Strings that were translated before don’t require any additional work.

You will see a summary of the new work and how much it costs. Deposit the payment and let the translators get to work.

When it’s done, go back to the Resource files section and click on the button to Create translations.

How to Translate Your Other Themes and Plugins

Many successful authors have more than one theme and plugin. ICanLocalize system makes it easy to translate all your products and reuse existing translations.

Don’t create new projects for your other products.

Go to the same project that you’ve already created and add more .po files to it. ICanLocalize system will identify which texts are new. You will need to pay only for them and not for what’s translated already.

Ready to get started?

Expert translators are waiting for your themes and plugins on ICanLocalize. We translate WPML, Toolset and many other popular plugins. To get started, create an account at ICanLocalize and use our Software Localization projects.