PIM/Enterprise Translation Howto

From KDE Community Wiki
< PIM
Revision as of 18:33, 26 August 2010 by TMG (talk | contribs) (add more markup)

Overview

Translations are currently only done in the e35 and in the e4 branches. e5 will follow later. Right now we use custom translation scripts, but for e4 and e5 we eventually plan to switch over to the KDE infrastructure to do all the work for us, after the Git migration is complete.

Setup

Apart from the setup needed below, please also follow the setup instructions in the README file so that the scripts will work properly. It is important to follow those instructions, especially about setting up environment variables. You also need to install Lokalize, which is the program used to edit .PO files. These .PO files contain the actual translations for each language. The translation scripts will create updated .PO files by scanning the source code and the documentation and extracting text that should be translated out of them.

Setup for e35

You need to have a installation of KDE3 somewhere, which needs to include kdesdk, as kdesdk has some scripts which are used internally by the translation scripts.

Setup for e4

Setup for the enterprise4 branch is a little bit more involved.

Check out the following folders, mirroring the SVN folder hierarchy. -N indicates that you should use the -N option to "svn up" to not pull all subdirectories.

trunk (-N)
trunk/KDE (-N)
trunk/KDE/kdesdk (-N)
trunk/KDE/kdesdk/scripts
branches (-N)
branches/kdepim (-N)
branches/kdepim/enterprise4 (-N)
branches/kdepim/enterprise4/kdepim
branches/kdepim/enterprise4/kdepimlibs
branches/kdepim/enterprise4/kdebase-4.2-branch
branches/kdepim/enterprise4/kdelibs-4.2-branch
branches/kdepim/enterprise4/l10n-kde4 (-N)
branches/kdepim/enterprise4/l10n-kde4/scripts
branches/kdepim/enterprise4/l10n-kde4/de (-N)
branches/kdepim/enterprise4/l10n-kde4/de/messages (-N)
branches/kdepim/enterprise4/l10n-kde4/de/messages/kdepim
branches/kdepim/enterprise4/l10n-kde4/de/messages/kdepimlibs
branches/kdepim/enterprise4/l10n-kde4/de/messages/kdelibs
branches/kdepim/enterprise4/l10n-kde4/de/messages/kdebase
branches/kdepim/enterprise4/l10n-kde4/templates (-N)
branches/kdepim/enterprise4/l10n-kde4/templates/messages (-N)
branches/kdepim/enterprise4/l10n-kde4/templates/messages/kdepim
branches/kdepim/enterprise4/l10n-kde4/templates/messages/kdepimlibs
branches/kdepim/enterprise4/l10n-kde4/templates/messages/kdelibs
branches/kdepim/enterprise4/l10n-kde4/templates/messages/kdebase

Now, you need to create some symlinks. In the branches/kdepim/enterprise4 directory, symlink kdebase-4.2-branch to kdebase and kdelibs-4.2-branch to kdelibs.

Updating PO and POT files

After the initial setup is complete, you'll see the PO files in the l10n-kde4/de/ (e4) and in the kde-l10n/de/ (e35) directories. There is also a templates/ directory with POT (PO template) files. As soon as text strings in the source code or in the documentation change, the PO and POT need to be updated. This can be done by simply calling the following bash functions:

  • e35: update_e3_translations
  • e4: update_e4_translations

The scripts will automatically update your source code checkout so that you don't get outdated translations. Running these can take a few minutes. Afterwards, the PO and POT files should be up-to-date and you can edit the PO files to add the translated strings. The update scripts will show you at the end which PO files have outdated translations and need to edited.

Editing Translations

The PO file editor for KDE is called Lokalize. Simply start it and open the PO files you want to update. The PO files you need to edit are located in the following directories:

  • e35:
kde-l10n/de/messages/kdepim/: Strings in the actual applications
kde-l10n/de/docmessages/kdepim/: Strings in the documentation handbook
  • e4:
l10n-kde4/de/messages/

Lokalize lets you jump to the next untranslated or to the next fuzzy message you need to translate, simply use that, add the translations and save the PO file. For more advanced features, and for a general guide to translating, see:

Special attention should be paid to crypto terms, they should be as consistent as possible. See The GPG4WIN phrasebook for some standard terms to use.

To double-check that you don't have missed some strings, run the function find_untranslated in the kde-l10n or in the l10n-kde4 dir. Afterwards, double-check that you have made the correct changes by viewing the diff with the po_diff function. Now you can commit the changes to the PO files and to the POT files by simply running

 svn ci -m "SVN_SILENT update translations"

in the kde-l10n or in the l10n-kde4 directory. After a successful commit, the translations are done.

Note that after committing, no changes in the source code can be made that change text strings, since otherwise the translations will be outdated again. Therefore, we have to avoid changing text strings in the source when the translations are committed, but the tags are not yet made. This needs coordination between the translators, the developers and the person doing the tags.

Installing and Testing Translations

After finishing the translations, one might want to directly test them, to see if they work as expected. First of all, you should install the current SVN versions of kdepim and kdepimlibs, as the translations of course need up-to-date applications that use the translations. After installing those, the translations itself need to be installed. For this, the PO files first need to be compiled to MO files, which are then installed. This can easily be done by running this function:

  • e35: install_e3_translations
  • e4: install_e4_translations

Before starting the applications, the KDE_LANG environment variable needs to be set up so that the correct translations are used. Simply type

 export KDE_LANG=de

before starting the PIM applications from console. Sometimes it might be necessary to kill the running kdeinit/kdeinit4 process before the translations can become fully active.