En:HOWTO: Translate Sabayon

From Sabayon Wiki
Revision as of 13:55, 5 October 2009 by Iki (talk | contribs) (changed svn links to git)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

HOWTO: Translate Entropy

Quick Guide

In this guide we'll supose we are going to translate Entropy to Finnish (language code: fi) - Yes, Finnish, why not?

Obtaining the files

First of all we need to get the file to translate. This file is called entropy.pot and it's very important to get the latest version of this file, that you'll find in entropy git repository: /misc/po/entropy.pot [1].

Now we have the file to translate in our disk, but we don't want to do any extra job, so we should also check if there's an earlier translation of Entropy for Finnish. If it exists we'll find this file in git too /misc/po/fi.po. We have to download also this file.

Note: The template is always called entropy.pot and the translated files are called 'languagecode'.po. (Where 'languagecode' is the standard code for each language)

Translating the file - tools

There are several ways to translate a file. We can use a simple text editor (i.e. kate), but it's not the best way, because the files we are going to translate contain more than just some text strings and if we change an incorrect character, the file won't work. So it's always better to use a translation program, that also checks spelling and other things. There are several programs to translate that will help you: Poedit, KBabel, ...). We are going to asume you are going to use Poedit (if it's not already in your system you can install it: it's in Entropy and also in Portage).

If we have a previous fi.po file, we open it with Poedit. To update the file to the last template we go to Catalog -> Update from POT file and browse to entropy.pot. The program will tell us that there are some new strings and some out-dated strings, we just say OK and the file gets up-to-date.

What about if we are going to translate Entropy to a language that doesn't have any older translation? Then we just open the entropy.pot file and we save it as 'languagecode'.po (Where 'languagecode' is the standard code for each language)

Poedit is very simple, the window is split in two: right-side and left-side. The left side is the side of the original sentences in English and the right side is the one of the sentences we are going to fill with the translation. If there are already translated strings you we'll see them at the right side. At the bottom you'll see the active sentence and the translation for that sentence.

Translating the file - let's go!

You'll see there are two kind of translated strings, the 'normal ones' and the 'yellow ones'. The yellow ones have the label of 'fuzzy' translations. It means that these strings have been auto-translated in a basis of a dictionary or previously translated similar strings. Fuzzy strings are usually all bad, though, so don't think it's an easier job to translate this ones. There's a button at the panel that controls the status of that strings (fuzzy/translated): the button with a cloud inside.

Another important thing is that fuzzy strings won't be shown as translated when the job is finished, so be sure that any fully translated strings remain as fuzzy when you finish your translation.

When you find strange characters in the middle of the sentences to translate (such as %d, %s, %f, \n, \p, %s/%s,...) you must mantain the exact characters in the translation: they are system symbols and if we change them the system will fail!!!

NOTE: We'll find some strings like "O_ther". What does that mean. It means that the "t" (next letter from the _ symbol) will be a shortcut for the keyboard in that sentence. How to translate it? As far as it's possible, we have to stay with the same letter at the shortcut, but... sometimes it's just impossible, because the translated word doesn't have any letter like the one we want. In that case, we can change the shortcut character, but that means more work: we'll have to check later that there are no repeated shortcut keys!

NOTE: po files have an specific beginning that Poedit will fill for you (it's not shown at the Poedit screen). At that beginning stays your name, the number of the revision (not much useful by now), the date, the codification of the language and some other things. We'll check all that later.

When you think the translation is finished, save the file as fi.po. We'll see that Poedit has created a new file called fi.mo at the same folder where we are working on.

Checking the translation

To check the translation we have to copy fi.mo to /usr/share/locale/fi/LC_MESSAGES/fi.mo and change it's name to entropy.mo. Then we can begin working with Entropy: etp-applet, Spritz and Equo and see how is our translation: everything should be shown in Finnish!

Now: is the translation process over? NO, it's not: To check if the translated file is correct we have to go across the menus and options, checking that the translated sentences are correct and have the original sense. We also have to check everywhere if there are repeated shortcuts at the menus and we'll have to change them if there are. You can also find sometimes strings much longer than the original, and maybe you'll see that some of these strings won't fit the buttons/windows and will appear shortened.

To repair all that you have to open again Poedit, look for the incorrect sentences and arrange them. This process should be repeated until the translation is as we want.

Before ending, you should open the file once with 'vi', 'nano', 'kate' or any simple editor (don't use openoffice or any other complex editors, because they add symbols to the sentences!) and check that the beginning of the file contains your name at the 'last-translator' field, your e-mail and the correct encoding for your language. If there was another translator before you, don't erase his/her name just put your one at his/her side.

As an example, the beginning of the file will be something like that:

File: fi.po
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <[email protected]>, YEAR.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-12-16 03:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

Don't change anything else than the beginning with an editor: the translation can become unusable if you change some incorrect characters!

Once we think the po file is correct we can send it to the forum, so it can be hanged up in subversion, and be usable for other users :)

That was just a quick guide. If you have any problems ask us, please!