Difference between revisions of "Translations"

From Navit's Wiki
Jump to: navigation, search
 
(Developers with commit access)
 
(42 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Updating a translation
+
=Submitting translations=
This is quite easy.
 
  
NavIt's source code changes a lot, almost everyday.
+
Navit uses [http://en.wikipedia.org/wiki/Gettext gettext] to display translated text.
Your translation my be out of date.
+
Gettext uses so-called ".po files" to hold the translated texts. The .po files for Navit are located in the source tree under navit/po. In Navit, they have the file ending .po.in (the .po files are generated from these files during the build).
Hopefully, it's quite easy to update your translation, with the newest strings, without loosing your work.
 
  
Simply use :
+
==Web-based translation tool==
  
msgmerge -U <yourlang>.po navit.pot
+
The easiest and prefered way to are the web-based translation tools of Launchpad:
 +
* https://translations.launchpad.net/navit/trunk
 +
This allows everybody who signs up at the service to browse/contribute/edit the translations of every language. You are guided by launchpad during the process and help is offered in the whole wizard. In case of any questions, please get in contact with the [[team]].
  
Now edit your po file, and translate the missing strings.
+
==.po.in files==
  
Adding new translations.
+
Please submit manual translations as patches against the .po.in files. Before correcting the translations, please update the .po.in file as described below.
If there's no .mo file for your language yet, you can contribute a translation. It's easy :)
 
  
 +
Before working on the translations, it's important for the '''po.in files to be current''' - the original texts in the source code change regularly, and if the .po.in files are not current, you may translate text that is no longer part of Navit.
  
Go into the po subfolder.
+
During Navit's build, .po files are generated automatically from the .po.in files under navit/po, taking into account any changed texts in the source code. To update a .po.in file, just do a complete build (make all), then copy the [language].po file that was created over the [language].po.in file. This new .po.in file will contain the strings as they appear in the source code, along with the old translations from the previous .po.in file. Old translations for texts that no longer occur in the source code will appear commented out (with a leading "#"). New strings from the source code will have emtpy translations.
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.
+
You can now correct/add translations, possibly using the old translations.
For each sentence, you'll get a block similar to this one :
 
  
#: src/main.c:88
+
==Developers with commit access==
msgid "Error parsing '%s': %s\n"
 
msgstr ""
 
  
The first line is a comment, indicating where the string was found. Usefull if you want to see the string in its original context.
+
Even if you have commit access, please ensure your translations go through Launchpad! Otherwise the next update from Launchpad will wipe out your work. Also, going through Launchpad ensures your translations are visible to contributors there so they won't unnecessarily translate strings which you have already taken care of.
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.
+
Launchpad lets you work online through the web interface, or offline by exporting .po files, editing them locally and uploading them back to Launchpad.
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
+
To upload a file to Launchpad:
 +
* '''Make sure your work is based on a translation file exported from Launchpad.''' This is a requirement in order to prevent translators who work offline from inadvertently reverting translations made by others. Launchpad will check all uploaded files and reject those that don't have an export timestamp set by Launchpad.
 +
* Open the translation page for the language you want to update. (If you can't find it, open the page for a random language and replace the language identifier in the URL.)
 +
* Click '''Upload translation'''.
 +
* Click '''Browse''' and select your translation file. '''The file must have a .po extension, else it will be rejected – rename it if necessary.'''
 +
* Click '''Upload'''.
 +
* You're almost done! Your translations now need to be reviewed in order to finish the import.
  
Theses particulars entries are used to define the correct grammar. The translation for theses items should be an integer.
+
The workflow to add translations is as follows:
Turn phrases are constructed this way :
+
* If you want to work online, make your edits first.
 +
* Pull the latest version of the source code from the repository.
 +
* Export translations from Launchpad (using the [https://translations.launchpad.net/navit/trunk/+export Download] link on the Translations Overview page) and copy them into your code tree.
 +
* Build Navit (for whichever platform you like) – this will regenerate the .po files in your build directory.
 +
* Rename the .po files that were created in your build directory to .po.in and copy them over the existing ones in the Navit code tree.
 +
* If you want to work offline, make your changes now, then upload the changed files to Launchpad.
 +
* Now commit your changes to SVN trunk. (A script to update translations from Launchpad is currently being worked on.)
  
Let's take an example :
+
=Dictionary=
 +
To have a consistent user experience, we have a dictionary of terms used in different places in our application. Please refer to this dictionary for translations.
  
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)
+
{|class="wikitable"
- strength_pos = 1
+
!English!!German
- direction_pos = 2
+
|-
- distance_pos = 3
+
|Bookmark||Lesezeichen
 +
|-
 +
|Waypoint||Wegpunkt
 +
|-
 +
|street, road||Straße<br>Straßenverlauf
 +
|-
 +
|exit||Ausfahrt
 +
|-
 +
|ramp||Auffahrt
 +
|-
 +
|roundabound||Kreisverkehr
 +
|-
 +
|position||Standort
 +
|-
 +
|roadbook||Wegbeschreibung
 +
|-
 +
|destination||Ziel
 +
|-
 +
|navigation||Navigation
 +
|-
 +
|position||Position
 +
|-
 +
|command||Befehl
 +
|-
 +
|Point||?Punkt
 +
|-
 +
|Map point||?Kartenpunkt
 +
|-
 +
|screen coord||Bildschirm
 +
|-
 +
|settings ||Einstellungen
 +
|-
 +
|vehicle||Fahrzeug
 +
|-
 +
|}
  
If you want something like : "in 100 meters turn strongly right" simply do the following :
+
===Not to translate===
- strength_pos = 2
+
*(OSM) "tag"
- direction_pos = 3
+
*"POI"
- 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.
 

Latest revision as of 23:27, 18 July 2015

Submitting translations[edit]

Navit uses gettext to display translated text. Gettext uses so-called ".po files" to hold the translated texts. The .po files for Navit are located in the source tree under navit/po. In Navit, they have the file ending .po.in (the .po files are generated from these files during the build).

Web-based translation tool[edit]

The easiest and prefered way to are the web-based translation tools of Launchpad:

This allows everybody who signs up at the service to browse/contribute/edit the translations of every language. You are guided by launchpad during the process and help is offered in the whole wizard. In case of any questions, please get in contact with the team.

.po.in files[edit]

Please submit manual translations as patches against the .po.in files. Before correcting the translations, please update the .po.in file as described below.

Before working on the translations, it's important for the po.in files to be current - the original texts in the source code change regularly, and if the .po.in files are not current, you may translate text that is no longer part of Navit.

During Navit's build, .po files are generated automatically from the .po.in files under navit/po, taking into account any changed texts in the source code. To update a .po.in file, just do a complete build (make all), then copy the [language].po file that was created over the [language].po.in file. This new .po.in file will contain the strings as they appear in the source code, along with the old translations from the previous .po.in file. Old translations for texts that no longer occur in the source code will appear commented out (with a leading "#"). New strings from the source code will have emtpy translations.

You can now correct/add translations, possibly using the old translations.

Developers with commit access[edit]

Even if you have commit access, please ensure your translations go through Launchpad! Otherwise the next update from Launchpad will wipe out your work. Also, going through Launchpad ensures your translations are visible to contributors there so they won't unnecessarily translate strings which you have already taken care of.

Launchpad lets you work online through the web interface, or offline by exporting .po files, editing them locally and uploading them back to Launchpad.

To upload a file to Launchpad:

  • Make sure your work is based on a translation file exported from Launchpad. This is a requirement in order to prevent translators who work offline from inadvertently reverting translations made by others. Launchpad will check all uploaded files and reject those that don't have an export timestamp set by Launchpad.
  • Open the translation page for the language you want to update. (If you can't find it, open the page for a random language and replace the language identifier in the URL.)
  • Click Upload translation.
  • Click Browse and select your translation file. The file must have a .po extension, else it will be rejected – rename it if necessary.
  • Click Upload.
  • You're almost done! Your translations now need to be reviewed in order to finish the import.

The workflow to add translations is as follows:

  • If you want to work online, make your edits first.
  • Pull the latest version of the source code from the repository.
  • Export translations from Launchpad (using the Download link on the Translations Overview page) and copy them into your code tree.
  • Build Navit (for whichever platform you like) – this will regenerate the .po files in your build directory.
  • Rename the .po files that were created in your build directory to .po.in and copy them over the existing ones in the Navit code tree.
  • If you want to work offline, make your changes now, then upload the changed files to Launchpad.
  • Now commit your changes to SVN trunk. (A script to update translations from Launchpad is currently being worked on.)

Dictionary[edit]

To have a consistent user experience, we have a dictionary of terms used in different places in our application. Please refer to this dictionary for translations.

English German
Bookmark Lesezeichen
Waypoint Wegpunkt
street, road Straße
Straßenverlauf
exit Ausfahrt
ramp Auffahrt
roundabound Kreisverkehr
position Standort
roadbook Wegbeschreibung
destination Ziel
navigation Navigation
position Position
command Befehl
Point ?Punkt
Map point ?Kartenpunkt
screen coord Bildschirm
settings Einstellungen
vehicle Fahrzeug

Not to translate[edit]

  • (OSM) "tag"
  • "POI"