Translations

From Navit's Wiki
Revision as of 08:30, 9 May 2008 by Singesang (talk | contribs) (Adding new translations.: Links fixed)
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, or poEdit two editors specifically designed for translations. For each sentence, you'll get a block similar to this one :

#: 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!

Configuring Speech in your language

To test results and for normal operation you should configure a speech program in navit.xml to listen the sentences, for example in spanish you could substitute the default speech definition:

<speech type="cmdline" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" />

with an appropiate one, that uses festival:

<speech type="cmdline" data="echo '%s' | festival --tts --language spanish" />

Here's how to use espeak:

<speech type="cmdline" data="espeak -s 150 -v german '%s' &amp;" />

where -s is the "Speed in words per minute" (150 seems to be quite good for german) and -v specifies the language to use. Please refer to espeak to see which languages you can use on your system and which other command-line-options are useful. The &amp; is replaced by & when the file is parsed and makes the call to espeak asynchronus. This is for not to freeze the GUI while espeak is speaking to you.

If you are running multiple programs with audio output, it is possible that /dev/dsp is locked (the default DSP for both festival and espeak). Use the following command to re-route the sound to ALSA. (To be exact, the Wave channel on the default sound card).

<speech type="cmdline" data="espeak -s 150 -v english --stdout '%s' | aplay > /dev/null &amp;" />