Home

Portato

  • Register
  • Sign in
  • Home
  • Download
  • Screenshots
  • Issues
  • Statistics
  • Development

  • Global Search
  • Projects

Translating

  • Support

Portato supports native languages. Nevertheless the translations into these languages have to be created. This page shows how to add a new translation or how to extend an existing translation.

Contents
  • 1 Short introduction about NLS in Linux
  • 2 Programs you (might) need
  • 3 Getting the sources
  • 4 Updating an incomplete translation
  • 5 Creating a new translation
  • 6 Placeholders
  • 7 Test your translation
  • 8 Submit your translation
  • 9 I found an untranslatable string
  • 10 GUIs suck - I want to use a text editor

Short introduction about NLS in Linux

All translatable strings of a program are listed in a *.pot file. For each translation a single {lang}.po file is created, which holds each translatable string and the corresponding translation. During installation these po-files are compiled into .mo files, which are then used to get the translations during runtime. If you are wondering, what is meant by {lang}: It is a code defining a language. It normally consists of two letters as defined by ISO 639-1, e.g. en, de, fr... If you want to differentiate between different kinds of one language, you append a modifier: en_US, en_GB, de_DE, de_AT etc.

Programs you (might) need

The recommended program for the translation is app-i18n/poedit, however you may want to try out kde-base/kbabel or app-text/gtranslator. Another simple option would be to use your normal text editor :) This guide will assume you are using poedit.

Getting the sources

You do need the sources to make translations, as the installed program is not sufficient. Therefore you need to have dev-util/git installed.

Change into a local directory where you want to have the sources installed. Then do:

git clone git://github.com/Necoro/portato.git
You now should have the actual sources in the "portato" subdirectory.

If you later on want to update these sources, you do:

git pull

Note: If you are working on a given version, you need to change to the correct branch:

git checkout -b 0.13 origin/0.13
where 0.13 has to be replaced by the version you are going to use.

Have a look at http://www.git-scm.com for more information on how to use git.

Updating an incomplete translation

If there is a translation for your language already, then open the {lang}.po file in portato's i18n/ directory with poedit. Select "Update from POT file" from the "Catalog" menu, then choose the messages.pot file in the i18n/ directory. Untranslated strings will be highlighted and placed at the top of the list. Translate them and save the file!

Creating a new translation

Open poedit and Select "New catalog from POT file" from the "File" menu, and choose the messages.pot file in portato's i18n/ directory. Translate, then save the file (also in the i18n/ directory) as {lang}.po.

Placeholders

The translatable strings in the messages.pot catalogue and the {lang}.po files are partially in Python's string format, partially in GTK's. The following items should be included in translated strings as placeholders for names or figures:

  • "%s" : string placeholder
  • "%d" : number placeholder
  • "%(days)d" : placeholder named "days", do not translate the name
  • pretty much anything starting with "%"

Html-Tags ("<b>some_text</b>") should be kept as is and only the text in between has to be changed.

In addition, the underscore (_) is used to indicate that the next character will be used as the accelerator key. When the user presses "CTRL" + this key, it will perform the item's action. These are not required, but if you use them the characters chosen must all be different.

Strings like "gtk-quit", "gtk-cancel" etc. must not be translated.

Test your translation

Before testing, run the "pocompile" script in the portato directory:

./pocompile.sh
This will compile all the .po files in i18n/ into .mo files and place them in the necessary subdirectories ({lang}/LC_MESSAGES).

Now you can run the local portato version in your language:

./portato.py

If you are not seeing your language, make sure the environment variable "LANG" is set to your language code. For example, to run portato using the German translation:

LANG="de_DE" ./portato.py

Submit your translation

The easiest way to submit your translation is to create a bug in the issues or to send a mail to portato@necoro.net.

I found an untranslatable string

Post a bug in the issues. Include the untranslatable string and where in Portato you came across it. It's easy for us to mark the strings for translation, but we may have missed some!

GUIs suck - I want to use a text editor

The .po files are plain text files. If you don't want to use poedit for some reason, these gettext commands might come in handy:

Update a .po file from the messages.pot file:

msgmerge {lang}.po messages.pot > newpofile.po

Create a new .po file from the messages.pot file:

msginit -i messages.pot -l {lang}

»
  • Login or register to post comments
Powered by
Powered by Oriact
Hosted on
Hosted on Origo
a project by ETH Zürich
© 2006 - 2010
Terms of Use