Public Member Functions | Public Attributes | Private Attributes
tornado.locale.Locale Class Reference
Inheritance diagram for tornado.locale.Locale:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def format_date
def format_day
def friendly_number
def get
def get_closest
def list
def translate

Public Attributes

 code
 name
 rtl
 translations

Private Attributes

 _months
 _weekdays

Detailed Description

Object representing a locale.

After calling one of `load_translations` or `load_gettext_translations`,
call `get` or `get_closest` to get a Locale object.

Definition at line 202 of file locale.py.


Constructor & Destructor Documentation

def tornado.locale.Locale.__init__ (   self,
  code,
  translations 
)

Reimplemented in tornado.locale.GettextLocale.

Definition at line 246 of file locale.py.


Member Function Documentation

def tornado.locale.Locale.format_date (   self,
  date,
  gmt_offset = 0,
  relative = True,
  shorter = False,
  full_format = False 
)
Formats the given date (which should be GMT).

By default, we return a relative time (e.g., "2 minutes ago"). You
can return an absolute date string with ``relative=False``.

You can force a full format date ("July 10, 1980") with
``full_format=True``.

This method is primarily intended for dates in the past.
For dates in the future, we fall back to full format.

Definition at line 276 of file locale.py.

def tornado.locale.Locale.format_day (   self,
  date,
  gmt_offset = 0,
  dow = True 
)
Formats the given date as a day of week.

Example: "Monday, January 22". You can remove the day of week with
``dow=False``.

Definition at line 362 of file locale.py.

def tornado.locale.Locale.friendly_number (   self,
  value 
)
Returns a comma-separated number for the given integer.

Definition at line 399 of file locale.py.

def tornado.locale.Locale.get (   cls,
  code 
)
Returns the Locale for the given locale code.

If it is not supported, we raise an exception.

Definition at line 227 of file locale.py.

def tornado.locale.Locale.get_closest (   cls,
  locale_codes 
)
Returns the closest match for the given locale code.

Definition at line 209 of file locale.py.

def tornado.locale.Locale.list (   self,
  parts 
)
Returns a comma-separated list for the given list of parts.

The format is, e.g., "A, B and C", "A and B" or just "A" for lists
of size 1.

Definition at line 382 of file locale.py.

def tornado.locale.Locale.translate (   self,
  message,
  plural_message = None,
  count = None 
)
Returns the translation for the given message for this locale.

If ``plural_message`` is given, you must also provide
``count``. We return ``plural_message`` when ``count != 1``,
and we return the singular form for the given message when
``count == 1``.

Reimplemented in tornado.locale.GettextLocale, and tornado.locale.CSVLocale.

Definition at line 266 of file locale.py.


Member Data Documentation

Definition at line 246 of file locale.py.

Definition at line 246 of file locale.py.

Definition at line 246 of file locale.py.

Definition at line 246 of file locale.py.

Definition at line 246 of file locale.py.

Definition at line 246 of file locale.py.


The documentation for this class was generated from the following file:


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Wed Sep 13 2017 03:18:20