Translations

From Navit's Wiki
Revision as of 12:23, 11 October 2007 by KaZeR (talk | contribs)
Jump to: navigation, search

Updating a translation

This is quite easy.

NavIt's source code changes a lot, almost everyday so your translation my be out of date. Hopefully, it's quite easy to update your translation, with the newest strings, without loosing your work.

Go into the source directory (extracted tarball for the releases, or the 'navit' directory fetched from cvs). Go into the 'po' subfolder.

Now edit your po file, and translate the missing strings. Don't forget to send us back your translation, so we can commit it into cvs (look at the bottom of this page).

Adding new translations.

If there's no translation for your language yet, you can contribute a translation. It's easy :)

Go into the po subfolder. Copy the navit.pot file to <yourlang>.po yourlang should be the iso code for your country, with two letters. (the first two of 'echo $LC_ALL' )

A .po file is simply a text file, but you may want to try kbabel, an editor specifically designed for translations. For each sentence, you'll get a block similar to this one :

  1. src/main.c:88

msgid "Error parsing '%s': %s\n" msgstr ""

The first line is a comment, indicating where the string was found. Useful if you want to see the string in its original context. The msgid is the original string. The msgstr is where you would put the translated string.

Warning : you have to respect the special characters in the string. You also have to respect the numbers of arguments in the string. \n is a newline. %s means that another string should go there %d is for a float number %i an integer.

The special case of strength_pos, direction_pos and distance_pos

Theses particulars entries are used to define the correct grammar. The translation for theses items should be an integer.

Let's take an example :

In the translated sentence "turn strongly right in 100 meters" the phrases "strongly" "right" and "100 meters" should be : (first="1", second="2" and third="3" position) - strength_pos = 1 - direction_pos = 2 - distance_pos = 3

If you want something like : "in 100 meters turn strongly right" simply do the following : - strength_pos = 2 - direction_pos = 3 - distance_pos = 1

You'll also need to move the "Turn" word in the string : msgid "Turn %s%s %s" msgstr "%s Turn %s%s"

The first %s would be replaced by the distance_pos, and so on.

Done? OK!

Once you have translated the file, send it back to us. Have a look at the Contacts page, or send them to kazer at altern dot org. Thanks for your help!