WPML 1.7.9 includes a significant change in the String Localization engine.
We’ve talked about it before, but I think that we never really gave a comprehensive guide about translating themes and plugins. Here goes.
First, let’s talk a minute about which languages you’re translating between.
If the default language of your site is English, you can just skip this section. Otherwise, please pay full attention — this is important stuff.
Your theme and plugins needs to be translated from English. Even if the default language for your site is Spanish (for example) and you’re translating only to Portuguese (yet, another example), English is involved too.
The original language of almost all themes and surely all plugins is English. If you’re using .mo files, they would include translation from English to both Spanish and Portuguese. Yup, although you don’t have English anywhere in your site’s contents, it still appears in many places, so you actually need to translate from English to your languages.
Normally, folks don’t need to worry too much about it, because they just download .mo files. So, why are we making a big deal of it?
Because WPML’s String Localization mechanism works exactly like GetText. It will translate everything from English to other languages. This means that if you’re using it also to translate admin texts, these texts need to be in English. We’ve talked about this a bit (with an example) in this blog post.
How to Translate
Now that we understand which languages to use, we need to start translating.
WPML gives you two options for translating strings. You can either use the GetText .mo files or use WPML’s String Translation mechanism.
These two solutions are functionally very similar. There’s also no performance difference. The only difference is the process you’re using.
Have a look at our theme localization guide. It shows exactly where to click and what to do to scan your theme and plugins.
Translating With WPML’s String Translation
WPML’s String Translation editor allows you to enter translations for each string in each language. It’s a simple editor, with search functionality. This interface is convenient if you’re translating for yourself, or if your translators already have WordPress user accounts.
In case you’re using our professional translation, your translators don’t need to touch the String Translation editor or log in to WordPress. Just click on the button to send the strings to your translators and you’re done.
Translating Using .mo Files
MO files are like dictionaries, telling how to translate strings from on language to another. You would need to have as many MO files as your site’s languages.
The process of translating with MO files goes like this:
- Create a POT file with the strings to translate. There are many tools for that. WPML includes a robust PHP scanner and can produce these POT files for you.
- Send the POT files to your translators. You might want to know that ICanLocalize also provides translation service for PO / POT files. You’re also welcome to learn more about it in the tutorial on translating PO and POT files.
- Get the PO and MO files from the translators and upload to your site. Each translator should return at least a PO (Portable Object) file. The PO file is the text version of the translation. From that, you can create a MO (Machine Object) file.
How is it Working for You?
Leave a comment and tell what you’re doing for theme and plugins localization!