Difference between revisions of "Translating STK"

(Testing your translation)
Line 44: Line 44:
 
* In a Windows command interpreter: <code>set LANG=de_DE</code> followed by <code>.\supertuxkart.exe</code> (that's for german, replace "de_DE" with the code if the langauge you want to test)
 
* In a Windows command interpreter: <code>set LANG=de_DE</code> followed by <code>.\supertuxkart.exe</code> (that's for german, replace "de_DE" with the code if the langauge you want to test)
 
* In a Cygwin shell: <code>$ env LANG=de_DE ./supertuxkart.exe</code>
 
* In a Cygwin shell: <code>$ env LANG=de_DE ./supertuxkart.exe</code>
 
followed by <code>.\supertuxkart.exe or ./supertuxkart.exe</code>
 
 
or, in one line :
 
<code>$ env LANG=sq_SQ ./supertuxkart.exe</code>
 
  
 
= Updating an existing translation =
 
= Updating an existing translation =

Revision as of 20:38, 17 September 2016

This article will explain how to translate STK into another language.

Installing poEdit

Note : you may use other tools but the procedure for them is not documented here
  • Get latest STK (to get all latest strings)

The directory where you need to go is /data/po. There you will see a file named supertuxkart.pot and a script called update_pot.sh. The .pot file contains all translatable strings of STK. The update_pot.sh script can be run from the base directory to update the .pot file, but you generally do not need to do that since the STK developers will do it for you.

Configuring poEdit

  • Make sure poEdit is configured to compile .mo files on saving (check in preferences)

File:Poedit prefs.png

  • from the View memu, check Show automatic comments window. This will make a new area appear : this area will sometimes contain tips that the devs left to help you translate a string, for instance if its meaning is ambiguous.

File:Poedit comments.png

Creating a new translation

  • Open poEdit and use menu File > New catalog from POT file.

File:Poedit1.png

  • Select supertuxkart.pot.

File:Poedit2.png

  • Enter the appropriate information in the dialog that pops-up (ignore fields you do not understand or that do not make sense for this project. Only the first tab needs to be completed)

File:Poedit3.png

  • Then simply select the strings in the list and enter a translation.
  • When you're done, save the file as [language code].po. Along it, a .mo file will be generated. Move the .mo file to /data/po/[language_code]/LC_MESSAGES/supertuxkart.mo.

Testing your translation

your translation should be automatically picked if your system is set to the language you made the translation for. If your system is in english or another language, you can force a language from terminal

  • On UNIX (Linux, Mac) : export LANG=[keycode] && export LC_MESSAGES=[keycode] then ./src/supertuxkart or so.
  • In a Windows command interpreter: set LANG=de_DE followed by .\supertuxkart.exe (that's for german, replace "de_DE" with the code if the langauge you want to test)
  • In a Cygwin shell: $ env LANG=de_DE ./supertuxkart.exe

Updating an existing translation

  • Open the language code.po file in poEdit.
  • Choose Catalog > update from POT file

File:Poedit update.png

  • Select supertuxkart.pot.

File:Poedit2.png

  • You will then get a summary of changes (new and/or obsolete strings) if any.
  • Then simply select the strings in the list and enter a translation.
  • When you're done, save the file. Along it, a .mo file will be generated. Move the .mo file to /data/po/[language_code]/LC_MESSAGES/supertuxkart.mo.