class Message: (source)
Representation of a single message in a catalog.
Method | __cmp__ |
Compare Messages, taking into account plural ids |
Method | __eq__ |
Undocumented |
Method | __ge__ |
Undocumented |
Method | __gt__ |
Undocumented |
Method | __init__ |
Create the message object. |
Method | __le__ |
Undocumented |
Method | __lt__ |
Undocumented |
Method | __ne__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | check |
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. |
Method | clone |
Undocumented |
Method | is |
Checks whether messages are identical, taking into account all properties. |
Instance Variable | auto |
Undocumented |
Instance Variable | context |
Undocumented |
Instance Variable | flags |
Undocumented |
Instance Variable | id |
Undocumented |
Instance Variable | lineno |
Undocumented |
Instance Variable | locations |
Undocumented |
Instance Variable | previous |
Undocumented |
Instance Variable | string |
Undocumented |
Instance Variable | user |
Undocumented |
Property | fuzzy |
Whether the translation is fuzzy. |
Property | pluralizable |
Whether the message is plurizable. |
Property | python |
Whether the message contains Python-style parameters. |
_MessageID
, string: _MessageID|None
= '', locations: Iterable[ tuple[ str, int]]
= (), flags: Iterable[ str]
= (), auto_comments: Iterable[ str]
= (), user_comments: Iterable[ str]
= (), previous_id: _MessageID
= (), lineno: int|None
= None, context: str|None
= None):
(source)
¶
Create the message object. :param id: the message ID, or a ``(singular, plural)`` tuple for pluralizable messages :param string: the translated message string, or a ``(singular, plural)`` tuple for pluralizable messages :param locations: a sequence of ``(filename, lineno)`` tuples :param flags: a set or sequence of flags :param auto_comments: a sequence of automatic comments for the message :param user_comments: a sequence of user comments for the message :param previous_id: the previous message ID, or a ``(singular, plural)`` tuple for pluralizable messages :param lineno: the line number on which the msgid line was found in the PO file, if any :param context: the message context
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. :rtype: ``iterator`` :param catalog: A catalog instance that is passed to the checkers :see: `Catalog.check` for a way to perform checks for all messages in a catalog.
Whether the translation is fuzzy. >>> Message('foo').fuzzy False >>> msg = Message('foo', 'foo', flags=['fuzzy']) >>> msg.fuzzy True >>> msg <Message 'foo' (flags: ['fuzzy'])> :type: `bool`