Package turbogears :: Package i18n :: Module utils

Module utils

source code

General i18n utility functions.

Classes
  TGURLopener
Functions
 
google_translate(from_lang, to_lang, text)
Translate text via the translate.google.com service.
source code
 
lang_in_gettext_format(lang) source code
 
get_accept_languages(accept)
Returns a list of languages, by order of preference, based on an HTTP Accept-Language string.See W3C RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) for specification.
source code
 
get_locale(locale=None)
Returns user locale, using _get_locale or app-specific locale lookup function.
source code
 
set_session_locale(locale)
Sets the i18n session locale.
source code
Variables
  __package__ = 'turbogears.i18n'
Function Details

google_translate(from_lang, to_lang, text)

source code 

Translate text via the translate.google.com service.

The source language is given by 'from_lang' and the target language as 'to_lang'. 'text' must be a unicode or UTF-8 encoded string.

set_session_locale(locale)

source code 

Sets the i18n session locale.

Raises an error if session support is not enabled.