class documentation

class Message(object):

View In Hierarchy

Representation of a single message in a catalog.
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 __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 clone Undocumented
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 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
catalogA catalog instance that is passed to the checkers
Returns
iteratorUndocumented
See Also
Catalog.check for a way to perform checks for all messages in a catalog.
def __cmp__(self, other):
Compare Messages, taking into account plural ids
def __eq__(self, other):

Undocumented

def __ge__(self, other):

Undocumented

def __gt__(self, other):

Undocumented

def __init__(self, id, string='', locations=(), flags=(), auto_comments=(), user_comments=(), previous_id=(), lineno=None, context=None):
Create the message object.
Parameters
idthe message ID, or a (singular, plural) tuple for pluralizable messages
stringthe translated message string, or a (singular, plural) tuple for pluralizable messages
locationsa sequence of (filename, lineno) tuples
flagsa set or sequence of flags
auto​_commentsa sequence of automatic comments for the message
user​_commentsa sequence of user comments for the message
previous​_idthe previous message ID, or a (singular, plural) tuple for pluralizable messages
linenothe line number on which the msgid line was found in the PO file, if any
contextthe message context
def __le__(self, other):

Undocumented

def __lt__(self, other):

Undocumented

def __ne__(self, other):

Undocumented

def __repr__(self):

Undocumented

def clone(self):

Undocumented

auto_comments =

Undocumented

context =

Undocumented

flags =

Undocumented

id =

Undocumented

lineno =

Undocumented

locations =

Undocumented

previous_id =

Undocumented

string =

Undocumented

user_comments =

Undocumented

@property
fuzzy =

Whether the translation is fuzzy.

>>> Message('foo').fuzzy
False
>>> msg = Message('foo', 'foo', flags=['fuzzy'])
>>> msg.fuzzy
True
>>> msg
<Message 'foo' (flags: ['fuzzy'])>
@property
pluralizable =

Whether the message is plurizable.

>>> Message('foo').pluralizable
False
>>> Message(('foo', 'bar')).pluralizable
True
@property
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