Summary

Some translatable files do not use gettext at runtime, but rather contain all translations in a single file, like .desktop, .server 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 Ubuntu. 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

Scope

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

Design

The Gnome 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 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

gnome.mk or debian/rules put the translation domain into the destination file.

This needs to be done without intermediate tools. intltool-merge is not appropriate for this task, because:

gnome library changes

pyxdg and libgnome-desktop have patches to support gettext:

gnome-panel is moving to use glib's GKeyFile and libgnome-desktop's parser is being set as deprecated. Glib is now patched and works fine. Current patch will only affect desktop files (identified by [Desktop Entry] group.

Benchmarks

To evaluate the performance impact of the additional gettext lookups, the time between login (pressing Enter after entering the password in gdm) and getting an usable menu (Applications menu drops down after clicking on it) was measured, first with the original packages, then with the patches applied and all desktop files enriched with the translation domain. This was tested on an AMD64/3000 (1.8 GHz), 1GB RAM, UDMA100 discs.

test case

original

patched

clean profile, cold boot

27s

27s

clean profile, relogin

13s

14s

big custom profile, cold boot

33s

35s

These results demonstrate that the performance penalty is negligible.

Outstanding issues

Random ideas about performance improvements (for historical reasons)


CategorySpec

LangpacksDesktopfiles (last edited 2008-08-06 16:30:07 by localhost)