Sun 10 Dec 2006
In Part 1, we discussed why localisation is important and explained what files you need and how to organise your theme, so that you can achieve a consistent presentation for your site and content. But what happens when there isn’t an .mo localisation file for your language? In Part 2, we explain how to localise any piece of software that has been designed for the purpose. Although this post will step through how to create a localisation (or a ‘catalog’) for Gengo, the information will also apply to a lot of other software packages out there, including WordPress itself and any localisable themes.
First things first, you need a .pot file. This is a template containing all of the text (or ’strings’) in the plugin or theme that you want to localise. You can download the .pot file for the latest version of Gengo here. If you download it now, you can follow the rest of this tutorial as we walk you through it. Sometimes, you might find a .po file - this is exactly the same, except that it will already have the translated strings filled in for another language. If there is no .pot file available, it might be that the plugin or theme wasn’t written with localisation in mind - in this case you have to hassle the author!
Secondly, you need a piece of software to help you with the translation process. For this demonstration, we’re going to use POEdit, which is small, easy-to-use and free. It is available for both Windows and *nix systems, with support for Mac coming soon. Of course, it is available in many languages!
Once you have downloaded and installed POEdit, run the program and open your .pot file. You will see a screen similar to this:

Next, is where you put your language ability to the use! POEdit reports that the current Gengo .pot file has 177 strings (or pieces of text), that need translating. Some of these are sentences, many are only single words, and some are just fragments. Larger software projects may have many thousands of strings. Click in the bottom left-hand text field and enter a translation for ‘Gengo Options’. If your language doesn’t use the roman alphabet we recommend the UTF-8 (Unicode) charset. For software and names in general, many people choose to leave those words in the original language, but the choice is yours - it’s your translation after all! Repeat this process for all of the strings in the software package. You will find some strings that have ‘%s’ in them - this is a variable that will be replaced with text when Gengo runs. Make sure you copy the ‘%s’ as if it was a real word, and place it in your translation where it is grammatically correct. If you don’t POEdit will mark the translation in red, to let you know that you’ve missed it out. In other strings, you might find HTML tags and special characters, such as ‘\’ - you should copy these exactly as well, or Gengo might fail to work properly. When you’ve finished, you’ll have a screen with a list of originals and translations. It should look something like this:
Next, you should add some information about your new catalog, by going to Catalog->Settings. You’ll see a screen where you can add information about yourself, your language and the project name and version. This is an example from the Gengo 0.8 French translation by Marc-Antoine Parent:
One final thing to check before you are finished is that POEdit will create an .mo file for you automatically. Go to File->Preferences, open the Editor tab and make sure “Automatically compile .mo file on save” is checked:
That’s it! Choose File->Save As from the menu and give your translation an appropriate filename. A useful convention that we use is ‘projectname-version-locale.po’. Note that you are saving this as a .po file, not a .pot file - it’s not a template any more, it’s a catalog! There is no real difference between the two, but it will help you to keep organised. The example we’ve been using is gengo-0.8-fr_FR.po. POEdit will create an .mo file for you automatically in the same directory as your .po file. If you open that up, you won’t be able to read anything, because it’s for machines, not humans! Take your newly-created .mo file and upload it to the appropriate directory, as was discussed in Part 1. Remember to remove the version number from the .mo file when you upload it! Our finished .mo file is gengo-fr_FR.mo, which matches the ‘fr_FR’ locale in use on this site.
Writing a translation is an excellent way of contributing to software that you use and would like to help out with, even if you don’t know any programming. Not only do you get the benefit of having consistency in your own site, you also get the satisfaction of knowing that you’ve created something yourself, as well as using your language talents to provide a service that other people can use. Your contribution will also help the author out and encourage more people to use the software.
If you’ve been following the tutorial and have a complete translation of the Gengo plugin, be sure to send it to us! We’ll put it up for everyone to use, along with your name, a note of thanks and a link to your site. There’s lots of information about localisation all over the Internet - Wikipedia has an explanation of the whole process of localisation and Google has lots more tutorials for POEdit if you get stuck. The WordPress Codex also has a rundown of what’s involved. What are you waiting for?! Get translating!
2 Responses
Comments:
Leave a Reply
You must be logged in to post a comment. Log in .
Trackbacks & Pingbacks:
-
Trackback from Cheap Custom Built Computers
November 28th, 2007 at 7:39 pmCheap Custom Built Computers…
I couldn’t understand some parts of this article, but it sounds interesting…
-
Trackback from How To Start A Blog
November 30th, 2007 at 7:59 amHow To Start A Blog…
I couldn’t understand some parts of this article, but it sounds interesting…
