Package Tools :: Module i18n
[hide private]
[frames] | no frames]

Module i18n

source code

Provides support for the internationalization of SUE using the python gettext module. Configures gettext to use the translation associated with the locale set by the user's environment at runtime. If no appropriate translation is found, the default language is used: the one in which the strings in the code are written (i.e. English).

The gettext function in the gettext module is alised as _ to match the name of the equivalent C function provided by GNU gettext tools.

See the Python documentation on the gettext module at http://docs.python.org/lib/module-gettext.html. A brief tutorial on i18n and Python is available at http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.002.htp


Authors:
Peter Parente, Frank Zenker
Organizations: Copyright: License:
Functions [hide private]
callable
bind(domain, locale_dir)
Convenience function for creating a new instance of a Python translation class bound to a domain and locale directory other than the default one for SUE.
source code
Variables [hide private]
  LOCALE_DIR = os.path.join('/usr/local', 'share', 'locale')
  DOMAIN = 'sue'
  _ = bind(DOMAIN, LOCALE_DIR)
Function Details [hide private]

bind(domain, locale_dir)

source code 
Convenience function for creating a new instance of a Python translation class bound to a domain and locale directory other than the default one for SUE. This function is useful in AEUserInterfaces which have translatable strings and ship separately from SUE with their own translation files. For instance, a AEScript writer may call this function globally in his AEScript and assign the result to a global variable _ to use the GNU translation system without affecting how other components of SUE are translated.
Parameters:
  • domain (string) - Filename of the translation file, typically the name of the project with which it is associated
  • locale_dir (string) - Directory to search for translation files for the domain
Returns: callable
Bound method ugettext on the translation object