How KDE supports Internationalization

O Manual de Programação do KDevelop: O Guia do Utilizador para Desenvolvimento de Aplicações C++ para o Ambiente de Trabalho K (KDE) com o ambiente de trabalho KDevelop, Versão 2.1
Prev | Capítulo 11. Internationalization | Next

# 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 QLabel s.

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.

Prev | Home | Next
Internationalization | Up | Adding a Language to your Project