LangpacksDesktopfilesKDE

Revision 1 as of 2006-01-27 08:24:18

Clear message

Summary

Some translatable files do not use gettext at runtime, but rather contain all translations in a single file, like .desktop and .directory files. We want to find a robust and generic way to update these translations through Rosetta and language packs.

Rationale

Currently the language packs contain only translations for desktop applications that use gettext. However, there are many more translatable items in Kubuntu. Our goal is to extract all translatable contents from application packages, import them into Rosetta, and ship them into language packs so that they can be updated after a release and benefit from Rosetta updates.

Use cases

  • Sjoerd adds a Dutch translation to a menu entry of a Breezy application in Rosetta. Breezy users should get this new translation with the next language pack update.

Scope

This specification deals with the KDE part. The Gnome counterpart is specified in LangpacksDesktopfiles.

Design

The KDE libraries that evaluates desktop/server/directory files should just use gettext() to translate entries since application's *.mo files already ship the translations.

In the past we proposed the extension of the [http://standards.freedesktop.org/desktop-entry-spec/latest/ FreeDesktop standard] to support an additional field TranslationDomain, so that Gnome, KDE, and other implementations can find the matching .mo file at runtime to get additional translations from it. However, since this has been rejected upstream, we will use our own Ubuntu-specific field for this.

Note that most upstream packages already use gettext to translate .desktop files at build time. For these packages, we only need to change the build system to put the translation domain into the destination files. Most packages that are of interest to us use cdbs and gnome.mk, thus modifying gnome.mk will already cover a very large percentage of packages.

Implementation

description files

TODO: how is the translation domain (as value of the new field X-Ubuntu-Gettext-Domain) added to the .desktop/.directory files? This should happen automatically, for Gnome packages it's done in cdbs' kde.mk.

KDE library changes

KConfig will need an i18n call to find the translation and fall back to the .desktop file if the .po does not contain a translation. i18n is done by KLocale and we will need to be careful not to create recursion between KConfig and KLocale.

KDE extracts .desktop files into .po files using createdesktop.pl (and supporting scripts in l10n/scripts in KDE's SVN). Use this script to generate .pot files that we will ship. We will modify this script to get it to add the gettext domain to the .desktop files.

Outstanding issues

  • If performance becomes an issue, we need to think about adding pre-caching of the translations.
  • SuSE uses one large .po file for this as operations such as loading the k-menu might be too slow with lots of smaller .po files.