Classes | Functions | Variables
tornado::locale Namespace Reference

Classes

class  CSVLocale
class  GettextLocale
class  Locale

Functions

def get
def get_supported_locales
def load_gettext_translations
def load_translations
def set_default_locale

Variables

string _default_locale = "en_US"
tuple _supported_locales = frozenset([_default_locale])
dictionary _translations = {}
 _use_gettext = False
dictionary LOCALE_NAMES

Function Documentation

def tornado.locale.get (   locale_codes)
Returns the closest match for the given locale codes.

We iterate over all given locale codes in order. If we have a tight
or a loose match for the code (e.g., "en" for "en_US"), we return
the locale. Otherwise we move to the next code in the list.

By default we return en_US if no translations are found for any of
the specified locales. You can change the default locale with
set_default_locale() below.

Definition at line 56 of file locale.py.

Returns a list of all the supported locale codes.

Definition at line 183 of file locale.py.

def tornado.locale.load_gettext_translations (   directory,
  domain 
)
Loads translations from gettext's locale tree

Locale tree is similar to system's /usr/share/locale, like:

{directory}/{lang}/LC_MESSAGES/{domain}.mo

Three steps are required to have you app translated:

1. Generate POT translation file
    xgettext --language=Python --keyword=_:1,2 -d cyclone file1.py file2.html etc

2. Merge against existing POT file:
    msgmerge old.po cyclone.po > new.po

3. Compile:
    msgfmt cyclone.po -o {directory}/pt_BR/LC_MESSAGES/cyclone.mo

Definition at line 143 of file locale.py.

def tornado.locale.load_translations (   directory)

Definition at line 84 of file locale.py.

Sets the default locale, used in get_closest_locale().

The default locale is assumed to be the language used for all strings
in the system. The translations loaded from disk are mappings from
the default locale to the destination locale. Consequently, you don't
need to create a translation file for the default locale.

Definition at line 70 of file locale.py.


Variable Documentation

Definition at line 50 of file locale.py.

Definition at line 52 of file locale.py.

Definition at line 51 of file locale.py.

Definition at line 53 of file locale.py.

Definition at line 422 of file locale.py.



rosbridge_server
Author(s): Jonathan Mace
autogenerated on Mon Oct 6 2014 06:58:14