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:
-
IBM Corporation
-
IT Science Center Ruegen gGmbH, Germany
Copyright:
-
Copyright (c) 2005, 2007 IBM Corporation
-
Copyright (c) 2007, 2008 ITSC Ruegen
License:
-
The BSD License
-
The BSD License
All rights reserved. This program and the accompanying materials
are made available under the terms of the BSD license which
accompanies this distribution, and is available at http://www.opensource.org/licenses/bsd-license.php
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
|
|
|
LOCALE_DIR = os.path.join('/usr/local', 'share', 'locale')
|
|
DOMAIN = 'sue'
|
|
_ = 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. 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
|