Package babel :: Package messages :: Module catalog :: Class Message

Class Message



object --+
         |
        Message

Representation of a single message in a catalog.

Instance Methods
 
__init__(self, id, string=u'', locations=(), flags=(), auto_comments=(), user_comments=(), previous_id=(), lineno={'territory_zones': {'001': ['Etc/GMT', 'Etc/GMT-1', 'Etc/GMT-...)
Create the message object.
 
__repr__(self)
repr(x)
 
__cmp__(self, obj)
Compare Messages, taking into account plural ids

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Instance Variables
  id
The message ID
  string
The message translation
Properties
bool fuzzy
Whether the translation is fuzzy.
bool pluralizable
Whether the message is plurizable.
bool python_format
Whether the message contains Python-style parameters.

Inherited from object: __class__

Method Details

__init__(self, id, string=u'', locations=(), flags=(), auto_comments=(), user_comments=(), previous_id=(), lineno={'territory_zones': {'001': ['Etc/GMT', 'Etc/GMT-1', 'Etc/GMT-...)
(Constructor)

 
Create the message object.
Parameters:
  • id - the message ID, or a (singular, plural) tuple for pluralizable messages
  • string - the translated message string, or a (singular, plural) tuple for pluralizable messages
  • locations - a sequence of (filenname, lineno) tuples
  • flags - a set or sequence of flags
  • auto_comments - a sequence of automatic comments for the message
  • user_comments - a sequence of user comments for the message
  • previous_id - the previous message ID, or a (singular, plural) tuple for pluralizable messages
  • lineno - the line number on which the msgid line was found in the PO file, if any
Overrides: object.__init__

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)

Property Details

fuzzy

Whether the translation is fuzzy.

>>> Message('foo').fuzzy
False
>>> msg = Message('foo', 'foo', flags=['fuzzy'])
>>> msg.fuzzy
True
>>> msg
<Message 'foo' (flags: ['fuzzy'])>
Get Method:
unreachable.fuzzy(self)
Set Method:
{'territory_zones': {'001': ['Etc/GMT',
                             'Etc/GMT-1',
                             'Etc/GMT-2',
                             'Etc/GMT-3',
                             'Etc/GMT-4',
                             'Etc/GMT-5',
                             'Etc/GMT-6',
                             'Etc/GMT-7',
...
Delete Method:
{'territory_zones': {'001': ['Etc/GMT',
                             'Etc/GMT-1',
                             'Etc/GMT-2',
                             'Etc/GMT-3',
                             'Etc/GMT-4',
                             'Etc/GMT-5',
                             'Etc/GMT-6',
                             'Etc/GMT-7',
...
Type:
bool

pluralizable

Whether the message is plurizable.

>>> Message('foo').pluralizable
False
>>> Message(('foo', 'bar')).pluralizable
True
Get Method:
unreachable.pluralizable(self)
Set Method:
{'territory_zones': {'001': ['Etc/GMT',
                             'Etc/GMT-1',
                             'Etc/GMT-2',
                             'Etc/GMT-3',
                             'Etc/GMT-4',
                             'Etc/GMT-5',
                             'Etc/GMT-6',
                             'Etc/GMT-7',
...
Delete Method:
{'territory_zones': {'001': ['Etc/GMT',
                             'Etc/GMT-1',
                             'Etc/GMT-2',
                             'Etc/GMT-3',
                             'Etc/GMT-4',
                             'Etc/GMT-5',
                             'Etc/GMT-6',
                             'Etc/GMT-7',
...
Type:
bool

python_format

Whether the message contains Python-style parameters.

>>> Message('foo %(name)s bar').python_format
True
>>> Message(('foo %(name)s', 'foo %(name)s')).python_format
True
Get Method:
unreachable.python_format(self)
Set Method:
{'territory_zones': {'001': ['Etc/GMT',
                             'Etc/GMT-1',
                             'Etc/GMT-2',
                             'Etc/GMT-3',
                             'Etc/GMT-4',
                             'Etc/GMT-5',
                             'Etc/GMT-6',
                             'Etc/GMT-7',
...
Delete Method:
{'territory_zones': {'001': ['Etc/GMT',
                             'Etc/GMT-1',
                             'Etc/GMT-2',
                             'Etc/GMT-3',
                             'Etc/GMT-4',
                             'Etc/GMT-5',
                             'Etc/GMT-6',
                             'Etc/GMT-7',
...
Type:
bool