Features/Enhanced Gettext

From Sugar Labs
Jump to navigation Jump to search


Enhanced Gettext adds an extra search path for translation files for Sugar activities. This would allow deployments to add and update activity translations independently of the release process.


  • Email: sayamindu at gmail dot com

Current status

  • Targeted release: 0.88
  • Last updated: Feb 09, 2010
  • Percentage of completion: 100%

Detailed Description

Currently the translation process is tightly coupled with the release workflow. In order to get the latest translations for a particular activity, deployments need to either wait for the activity maintainer make a new release, or use the language pack mechanism, which is distribution specific, and an ugly hack at its best. This feature would add a sugar.gettext module, which, if used by activities, will search an alternative path (configurable via GConf) for translations before looking into the activity directory (where the translations present in the original release bundle exist.

Benefit to Sugar

  • Life becomes a lot easier for deployments who rely on a small translator team to accomplish the job (smaller translation teams find it more difficult to keep up with the Sugar release cycle)
  • Activity maintainers do not have to worry about making new releases to incorporate newer translations.
  • See thread starting from http://www.mail-archive.com/sugar-devel@lists.sugarlabs.org/msg10663.html
  • Will enable decoupling of Fructose release schedule from Glucose release schedule (if required, Fructose can be discarded altogether without causing much pains from the localization point of view)


  • A sugar.gettext module needs to be created in sugar-toolkit (or sugar-base ??)
  • Activity authors need to do import sugar.gettext instead of import gettext (it may make sense to keep the import sugar.gettext in a try: block to retain backward compatibility)

UI Design


How To Test

Testing without language packs

This is mostly regression testing, in order to ensure that we do not break existing stuff with the new patch.

  • Set the locale to something other than en_US.UTF-8 (by editing ~/.i18n). As an example, it can be de_DE.UTF-8 or es_PE.UTF-8
  • Restart Sugar or sugar-emulator
  • Start random activity
  • Ensure that the translated strings come up properly

Testing with language packs

This tests support for language packs (which are essentially translation files which can be installed separately from the activities later on by deployments)

  • Set the locale to es_PE.UTF-8 by editing ~/.i18n (it should read LANG=es_PE.UTF-8)
  • Restart Sugar or sugar-emulator
  • Set the GConf key /desktop/sugar/i18n/langpackdir to some random directory (say /foo)
    • The best way to do this would be to start Terminal and use the command gconftool-2 --set -t string /desktop/sugar/i18n/langpackdir /foo (this will create the key if it does not exist as well)
  • Make directory /foo (with the command mkdir -p /foo)
  • Make directory /foo/es_PE/LC_MESSAGES
  • Download http://people.sugarlabs.org/~sayamindu/org.laptop.sugar.ReadActivity.mo into /foo/es_PE/LC_MESSAGES
  • Start Read Activity and confirm if the translation string for the Fullscreen button comes up as "FooBar"
  • Remove the file org.laptop.sugar.ReadActivity.mo
  • Restart Read Activity
  • Confirm if the translation string for the Fullscreen button comes up as Pantalla completa

User Experience




Contingency Plan

None necessary, revert to previous release behaviour.


Release Notes

The extension adds a new dependency of the Python dateutil module. In Fedora and Ubuntu/Debian this is provided by the package python-dateutil.

Comments and Discussion