Friday, January 12, 2007

How to Translate Canola GUI into your language

I recently heard the call made by the Canola Media player development team, to in their words...... " Guys, if you want to contribute with canola, here's an opportunity! Translate canola into your own language! "

So over that last couple of weeks in my spare time I have learnt from scratch how to go about creating French and Spanish translations of the Canola Media Player Interface.

This was my first attempt at any GUI translation, I was a complete beginner at the start of the task. Hopefully this overview "How to" will provide guidance on how to create the necessary translation files for the Canola GUI into your own mother language. (This method can be used by anyone to provide international translations of various Linux GUI applications)

Follow me, as I gradually understand (step by step?) how to edit, update and save the required translation files.

1) First I download the originating Canola i18n files (POT) of the Canola interface from maemo.org then unzipped them where thanks to M$ Windows they were immediately associated with M$ Powerpoint as templates. Grrrrrrrr


2) Because I am normally a windows XP user in the home (and although my Nokia 770 OS is Linux) the first thing I did, was to take a quick look at the content of one of them with the trusty old windows notepad application.

Urrrghh, what's the congealed mess I said to myself.

3) I then fired up firstobject XML Editor to see if it presented the text in a more clear and formatted manner.

That's much better, it's now easy on the eye and I can look at the editing task ahead. Initially I thought that this XML editor was ideal with it's small footprint on the PC (Just an exe and no registry changes etc) I do like it's simplicity and ability to open and tile/work with multiple files at a time for easy cutting and pasting i.e.

4) I then opened the Babelfish webpage in Firefox my favourite web browser to begin translating the English (msgid) strings into French (msgstr) strings.

I appreciate that is not necessarily the best way to start, but I wanted a quick feel for the task ahead, believing it's better to prepare a quick general translation, then discuss accuracy with a few friends because translating from one mother tongue to another as we all know is fraught with problems.

I calmly and methodically edited all the provided *.pot files saving them with the same extension but adding French in titles accordingly. I had no idea what elements of the file header needed modifying and was not sure how to record and change date/time accurately every time I modified the file. (using the XML editor)

5) I then dived onto the web to find out more about *.pot files and found a useful section in Free/Open source software "A guide to Localisation" which would have been very helpful before the start of my activities. "Gettext: Architectural Overview" and "The POT and PO file format" sections of the guide give an effective overview of Word Internationalisation "i18n" and *.pot and *.po files

6) OK, Now I am beginning to get it, I downloaded poedit which as I found out is a program specifically designed for creating *.po from *.pot files which runs fine on M$ Windows. I now understand that the *.pot files can be constantly updated as the GUI further develops.

The *.po files understand (with Poedit) how to take the additions/modifications from the *.pot adding them to the *.po automatically (So the person translating only needs to add translation for the added/modified items which are easy to see in the Poedit interface)

Basically you highlight a line in the file and then you are able to edit the translation and make comments etc. (The catalog, settings: window allows for modification to file header records i.e. Team and email values)



7) My understanding of completed canola translations at time of this post are

Brazilian pt_BR
Catalan ca_ES
French fr_FR
German de_DE
Italian it_IT
Polish pl_PL
Spanish es_ES

Where currently the most up-to-date list and downloads of translated *.po and also the originating *.pot can be found in the zip files held here.

8) Please be aware that currently none of the translations will work with Canola 1.0 (beta1) version as its not ready to interface with them. However the more translations that are provided by the Canola user community, the more that will be available when a version of Canola is released that supports the GUI translation *.po files.

9) Of course this "how to" is only an overview for windows users, but I would like to think that everyone who wants a little understanding of GUI translation in Linux will find it useful.

I would like to thank Gustavo Sverzut Barbieri and Hanful for their support, whilst I gained an understanding of what was required to create the Canola GUI and Config translation files.

If you have any comments, questions or suggestions, please add them by commenting against this blog post.

2 comments:

Imrahil said...

Great tutorial! Can I make similar guide for polish users?

Jarek

MikeL said...

Amrothos

I have no problem with you utilising the information in my overview "how to" guide translated into Polish!
If you put it on the Internet (In your blog) a link to my blog post would be nice.
Perhaps I will also pick up tips from your tutorial.

I am very happy you found it useful and helpful.

Gustavo

Thank you for the wiki ref on the end-of-line differences between MS-DOS and UNIX. In the wiki it explains that if I had used Wordpad I would have been fine in relation to correct understanding of end-of-line whilst using a Windows PC. (So I tried MS Wordpad and *.pot *.po files are viewed just fine)

I always believed that Notepad was the safest editor in Windows if you want to be sure not to corrupt a file.

ALL

Useful things I neglected to mention in the How To about the Poedit application are :-

1) I believe that to more or less correctly set the header records in *.po files, go into the Catalog/Settings option and set the following:-

a) Select correct language and country of your translation
b) Set the charset to: utf-8
c) The project name is currently: canola 1.0
d) Team is currently: barbieri@gmail.com
e) email address should be: Youremailaddress

2) When the files are modified and saved, the time and date stamp is automatically updated within the *.po file
3) The translator user, is restricted to editing only the translation strings and not the originating string in the editor window.
4) Comments can be added, so if you are not happy with an originating string or your translation you can leave a comment.

Please Note: I am NO expert on Poedit, just scratching the surface of the application.
Kbabel is the equivalent and looks to be a far superior application for Linux users: http://kbabel.kde.org/