The KDevelop Programming Handbook: Internationalization

Next Previous Table of Contents

### 11. Internationalization

### 11.1 What is i18n ?

i18n is an internationalization system that is used to offer internationalized versions of an application or project. The difficulty with writing applications is that they only support the language they originally are composed with; visually this can be seen on labels, menu entries and the like. Goal of the internationalization is to provide applications and library functions in the language of the user; therefore enabling users that are not capable of the original language to make use of the provided functionality and feel more comfortable.

### 11.2 How KDE supports Internationalization

KDE, as one of the most modern desktop environments, has set one of its numerous goals to provide applications for users in their native languages, and simplifies the work for developers to provide their application in any of the supported language.

Technically, this is realized by the KDE File System Standard which contains localization support for languages in terms of documentation and by providing application internationalization through the use of the KDE-core library class `KLocale`. This class does all the translation, dependent on the preferred language set in the KDE Control Center.

The developer on the other hand only has to know two things to make his application able to use this feature:

1. include `kapp.h` into your sourcecode wherever a visible text appears in your application, e.g. in source files that contain QLabels.
2. wherever you set the visual string, embrace it with the `i18n()` macro provided by `kapp.h` to enable translation.
3. whenever you have to access a locale object, use the `klocale` macro provided by `kapp.h`

That is almost all you have to watch for while coding. Mind that you should not internationalize any configuration strings that are used by `KConfig`, because this is not necessary on one hand and doesn't work for reading in values on the other.

### 11.3 Adding a Language to your Project

KDevelop also takes part on making life easier for developers to include native language support to their applications. Whenever you create a new KDE project, a `po` directory is added to the main project directory. There, your <application>.pot file will be placed after the generation is complete. The .pot file already contains all strings that are set up with the i18n() macro, therefore you only have to write your code using the macro again. From time to time, you should do a "Project"-"Make messages and merge", which will automatically extract all macros again and rebuilds the potfile.

To add a language to your application, choose "Project"-"Add translation file", which opens the language selection dialog. Select the desired language and press OK. Then, the according <lang>.po file will be build in the `po` directory. Then start translating the po file by selecting it from the po directory in the Real File Viewer or from the LFV, folder "Translations". If you have KTranslator installed, it will be opened in the "Tools" window with KTranslator, otherwise as a text file in the header/resource window. KTranslator makes it very easy to translate strings by scanning the existing translations of your local KDE installation, so they can be used already.

For editing by hand, we'll have a look at an example:

> `

>     #: kscribble.cpp:619
>     msgid "Opens an existing document"
>     msgstr ""

> `

The above shows a string that was extracted from the file `kscribble.cpp` at line 619. `msgid` and `msgstr` are the tags which give the information for the translation; `msgstr` will contain the translated string. There, you have to watch escape sequences such as \n or \t, which have to be included into the translation string. A German translation would therefore look like this:

> `

>     #: kscribble.cpp:619
>     msgid "Opens an existing document"
>     msgstr "Öffnet ein existierendes Dokument"

> `

That would be all to watch for translation; after you're done, save the file. When make is run within the po directory, the message files will be processed and errors may occur if strings are not translated consistently, e.g. escape sequences are missing. Then edit the according message string again and make sure that make runs without errors.

Additionally, you should be very careful when translating ampersands within text strings. The letters after ampersands are used as keyboard accelerator s in conjunction with the ALT key to access menubar or popup menu items to change the keyboard focus to the selected item more quickly. Now, if the same accelerator letter appears in the same keyboard focus area (which would be the main widget on one time, and a dialog at another), each widget after the first one cannot be accessed by the supposed keyboard accelerator . So even translators have a responsibility for the usage of the application under their language. There is also no guarantee that the original letter will occur in the translation, so translators have to choose very carefully and should test the application under their language after they installed the translation to ensure it runs without these malfunctions.

### 11.4 Translation Team Contacts

The KDE Team also provides numerous contacts to developers that are contributing to the KDE project as translators. Those are organized in language teams and coordinate the translation work. For an actual list and information who to ask for translating your application, see http://www.kde.org.

The information below is taken from the KDE web site and contains the current contact addresses as of March 06, 1999. If you want to join a team please write directly to one of the team coordinators.

The translation of the KDE is organized by Juraj Bednar mailto:bednar@rak.isternet.sk and Matthias Elter me@kde.org

You can subscribe KDE internationalization mailing list kde-i18n-doc@kde.org by sending a mail to kde-i18n-doc-request@kde.org with the word "subscribe" in the subject line.

Before starting any translation work, please contact the according translation team leaders for coordination to avoid double work.

br Breton translation team:

  team coordinators: Jañ-Mai DRAPIER jdrapier@club-internet.fr website: http://perso.club-internet.fr/jdrapier

ca Catalan translation team:

  team coordinators: Sebastià Pla sastia@redestb.es

cs Czech translation team:

  team coordinators: Miroslav Flídr flidr@kky.zcu.cz

da Danish translation team:

  team coordinators: Erik Kjær Pedersen erik@binghamton.edu

de German translation team:

  team coordinators: Thomas Diehl th.diehl@gmx.net website: http://www.dtp-service.com/kde/de/ mailing list: send a mail with 'subscribe' in the subject line to: kde-i18n-de-request@kde.org Webforum for discussions and user feedback: http://www.dtp-service.com/discus_d

el Greek translation team:

  team coordinators: Theodore J. Soldatos theodore@eexi.gr

eo Esperanto translation team:

  team coordinators: Wolfram Diestel diestel@rzaix340.rz-uni-leipzig.de

es Spanish translation team:

  team coordinators: Boris Wesslowski, Alonso Lara Boris@Wesslowski.com website: http://members.xoom.com/keko5/ mailing list: send a mail with 'subscribe' in the subject line to kde-es@kde.org

et Estonian translation team:

  team coordinators: Hasso C. Tepper hasso@ewsound.estnet.ee

fi Finnish translation team:

  team coordinators: Kim Enkovaara kim.enkovaara@iki.fi

fr French translation team:

  team coordinators: Francois-Xavier Duranceau Francois-Xavier.Duranceau@loria.fr website: http://www.loria.fr/~durancea/kde/wip-apps.html mailing list: send an empty mail to: kde-traduc-fr-subscribe@egroups.com

he Hebrew translation team:

  team coordinators: Erez Nir erez-n@actcom.co.il

hr Croatian translation team:

  team coordinators: Vladimir Vuksan vuksan@veus.hr

hu Hungarian translation team:

  team coordinators: Marcell Lengyel miketkf@yahoo.com website: http://sophia.jpte.hu/~kde

is Icelandic translation team:

  team coordinators: Logi Ragnarsson, logir@imf.au.dk Thorarinn R. Einarsson, thori@mindspring.com Bjarni R. Einarsson, bre@netverjar.is Hrafnkell Eiriksson, hkelle@rhi.hi.is Gudmundur Erlingsson, gudmuner@lexis.hi.is Richard Allen ra@hp.is

it Italian translation team:

  team coordinators: Andrea Rizzi rizzi@kde.org

ko Korean translation team:

  team coordinators: LinuxKorea Co. kde@linuxkorea.co.kr

mk Macedonian translation team:

  team coordinators: Sasha Konecni sasha@msi-uk.com

nl Dutch translation team:

  team coordinators: flidr@CyberGate.zcu.cz flidr@CyberGate.zcu.cz

no Norwegian translation team:

  team coordinators: Hans Petter Bieker zerium@webindex.no

pl Polish translation team:

  team coordinators: Piotr Roszatycki dexter@fnet.pl

pt Portuguese translation team:

  team coordinators: Pedro Morais pmmm@camoes.rnl.ist.utl.pt

pt_BR Brazil Portuguese translation team:

  team coordinators: Elvis Pfützenreuter epx@netville.com.br

ro Romanian translation team:

  team coordinators: Paul Ionescu ipaul@romsys.ro

ru Russian translation team:

  team coordinators: Denis Y. Pershin dyp@inetlab.com

sk Slovak translation team:

  team coordinators: Juraj Bednar bednar@isternet.sk mailling list: send a mail with 'subscribe' in the subject line to: sk-i18n@rak.isternet.sk

sl Slovenian translation team:

  team coordinators: blazzupancic@hotmail.com blazzupancic@hotmail.com

sv Swedish translation team:

  team coordinators: Anders Widell d95-awi@nada.kth.se

tr Turkish translation team:

  team coordinators: Gorkem Cetin gorkem@linux.org.tr

zh_GB2312 Simplified Chinese translation team:

  team coordinators: Wang Jian larkw@263.net

zh_TW_Big5 Chinese BIG5 translation team:

  team coordinators: Chou Yeh-Jyi ycchou@ccca.nctu.edu.tw

Next Previous Table of Contents