class documentation

class Message: (source)

View In Hierarchy

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_identical Checks whether messages are identical, taking into account all properties.
Instance Variable auto_comments Undocumented
Instance Variable context Undocumented
Instance Variable flags Undocumented
Instance Variable id Undocumented
Instance Variable lineno Undocumented
Instance Variable locations Undocumented
Instance Variable previous_id Undocumented
Instance Variable string Undocumented
Instance Variable user_comments Undocumented
Property fuzzy Whether the translation is fuzzy.
Property pluralizable Whether the message is plurizable.
Property python_format Whether the message contains Python-style parameters.
def __cmp__(self, other: object) -> int: (source)

Compare Messages, taking into account plural ids

def __eq__(self, other: object) -> bool: (source)

Undocumented

def __ge__(self, other: object) -> bool: (source)

Undocumented

def __gt__(self, other: object) -> bool: (source)

Undocumented

def __init__(self, id: _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

def __le__(self, other: object) -> bool: (source)

Undocumented

def __lt__(self, other: object) -> bool: (source)

Undocumented

def __ne__(self, other: object) -> bool: (source)

Undocumented

def __repr__(self) -> str: (source)

Undocumented

def check(self, catalog: Catalog|None = None) -> list[TranslationError]: (source)

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.

def clone(self) -> Message: (source)

Undocumented

def is_identical(self, other: Message) -> bool: (source)

Checks whether messages are identical, taking into account all properties.

auto_comments = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

locations = (source)

Undocumented

previous_id = (source)

Undocumented

Undocumented

user_comments = (source)

Undocumented

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`

@property
pluralizable: bool = (source)

Whether the message is plurizable. >>> Message('foo').pluralizable False >>> Message(('foo', 'bar')).pluralizable True :type: `bool`

@property
python_format: bool = (source)

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 :type: `bool`