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=None) Create the message object. |
__repr__(self) repr(x) |
__cmp__(self, obj) Compare Messages, taking into account plural ids |
clone(self) |
`iterator` |
check(self, catalog=None) Run various validation checks on the message. |
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

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=None) (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)

### check(self, catalog=None) |
Run various validation checks on the message. Some validations are only performed if the catalog is provided. This method returns a sequence of TranslationError objects. Parameters: `catalog` - A catalog instance that is passed to the checkers Returns: `iterator` See Also: Catalog.check for a way to perform checks for all messages in a catalog.

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) Type: `bool`

### pluralizable Whether the message is plurizable.
    >>> Message('foo').pluralizable
    False
    >>> Message(('foo', 'bar')).pluralizable
    True
Get Method: unreachable.pluralizable(self) 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) Type: `bool`