Package turbogears :: Package i18n :: Module tg_gettext

Module tg_gettext

source code

Classes
  lazystring
Has a number of lazily evaluated functions replicating a string.
Functions
 
get_locale_dir() source code
 
is_locale_supported(locale, domain=None)
Check if [domain].mo file exists for this language.
source code
 
get_catalog(locale, domain=None)
Return translations for given locale.
source code
 
plain_gettext(key, locale=None, domain=None)
Get the gettext value for key.
source code
 
tg_gettext(key, locale=None, domain=None)
Get the gettext value for key.
source code
 
plain_ngettext(key1, key2, num, locale=None)
Translate two possible texts based on whether num is greater than 1.
source code
 
lazify(func) source code
 
jsonify_lazystring(obj) source code
 
lazy_gettext(*args, **kw)
Get the gettext value for key.
source code
 
lazy_ngettext(*args, **kw)
Translate two possible texts based on whether num is greater than 1.
source code
 
gettext(key, locale=None, domain=None)
Get the gettext value for key.
source code
 
ngettext(key1, key2, num, locale=None)
Translate two possible texts based on whether num is greater than 1.
source code
 
install()
Add the gettext function to __builtins__ as '_'.
source code
Variables
  log = logging.getLogger("turbogears.i18n")
  __package__ = 'turbogears.i18n'
Function Details

plain_gettext(key, locale=None, domain=None)

source code 

Get the gettext value for key.

Added to builtins as '_'. Returns Unicode string.

Parameters:
  • key - text to be translated
  • locale - locale code to be used. If locale is None, gets the value provided by get_locale.

tg_gettext(key, locale=None, domain=None)

source code 

Get the gettext value for key.

Added to builtins as '_'. Returns Unicode string.

Parameters:
  • key - text to be translated
  • locale - locale code to be used. If locale is None, gets the value provided by get_locale.

plain_ngettext(key1, key2, num, locale=None)

source code 

Translate two possible texts based on whether num is greater than 1.

Parameters:
  • key1 - text if num==1
  • key2 - text if num!=1
  • num (integer) - a number

jsonify_lazystring(obj)

source code 
Decorators:
  • @jsonify.when("isinstance(obj, lazystring)")

lazy_gettext(*args, **kw)

source code 

Get the gettext value for key.

Added to builtins as '_'. Returns Unicode string.

Parameters:
  • key - text to be translated
  • locale - locale code to be used. If locale is None, gets the value provided by get_locale.

lazy_ngettext(*args, **kw)

source code 

Translate two possible texts based on whether num is greater than 1.

Parameters:
  • key1 - text if num==1
  • key2 - text if num!=1
  • num (integer) - a number

gettext(key, locale=None, domain=None)

source code 

Get the gettext value for key.

Added to builtins as '_'. Returns Unicode string.

Parameters:
  • key - text to be translated
  • locale - locale code to be used. If locale is None, gets the value provided by get_locale.

ngettext(key1, key2, num, locale=None)

source code 

Translate two possible texts based on whether num is greater than 1.

Parameters:
  • key1 - text if num==1
  • key2 - text if num!=1
  • num (integer) - a number
  • locale - locale code to be used. If locale is None, gets the value provided by get_locale.