|
| None | __init__ (self, _MessageID id, _MessageID|None string='', Iterable[tuple[str, int]] locations=(), Iterable[str] flags=(), Iterable[str] auto_comments=(), Iterable[str] user_comments=(), _MessageID previous_id=(), int|None lineno=None, str|None context=None) |
| |
|
str | __repr__ (self) |
| |
| int | __cmp__ (self, object other) |
| |
|
bool | __gt__ (self, object other) |
| |
|
bool | __lt__ (self, object other) |
| |
|
bool | __ge__ (self, object other) |
| |
|
bool | __le__ (self, object other) |
| |
|
bool | __eq__ (self, object other) |
| |
|
bool | __ne__ (self, object other) |
| |
| bool | is_identical (self, Message other) |
| |
|
Message | clone (self) |
| |
| list[TranslationError] | check (self, Catalog|None catalog=None) |
| |
| bool | fuzzy (self) |
| |
| bool | pluralizable (self) |
| |
| bool | python_format (self) |
| |
| bool | python_brace_format (self) |
| |
|
|
| id |
| |
|
| string |
| |
|
| locations |
| |
|
| flags |
| |
|
| auto_comments |
| |
|
| user_comments |
| |
|
| previous_id |
| |
|
| lineno |
| |
|
| context |
| |
Representation of a single message in a catalog.
◆ __init__()
| None babel.messages.catalog.Message.__init__ |
( |
|
self, |
|
|
_MessageID |
id, |
|
|
_MessageID | None |
string = '', |
|
|
Iterable[tuple[str, int]] |
locations = (), |
|
|
Iterable[str] |
flags = (), |
|
|
Iterable[str] |
auto_comments = (), |
|
|
Iterable[str] |
user_comments = (), |
|
|
_MessageID |
previous_id = (), |
|
|
int | None |
lineno = None, |
|
|
str | None |
context = None |
|
) |
| |
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
◆ __cmp__()
| int babel.messages.catalog.Message.__cmp__ |
( |
|
self, |
|
|
object |
other |
|
) |
| |
Compare Messages, taking into account plural ids
◆ 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.
: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.
◆ fuzzy()
| bool babel.messages.catalog.Message.fuzzy |
( |
|
self | ) |
|
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`
◆ is_identical()
| bool babel.messages.catalog.Message.is_identical |
( |
|
self, |
|
|
Message |
other |
|
) |
| |
Checks whether messages are identical, taking into account all
properties.
◆ pluralizable()
| bool babel.messages.catalog.Message.pluralizable |
( |
|
self | ) |
|
Whether the message is plurizable.
>>> Message('foo').pluralizable
False
>>> Message(('foo', 'bar')).pluralizable
True
:type: `bool`
◆ python_brace_format()
| bool babel.messages.catalog.Message.python_brace_format |
( |
|
self | ) |
|
Whether the message contains Python f-string parameters.
>>> Message('Hello, {name}!').python_brace_format
True
>>> Message(('One apple', '{count} apples')).python_brace_format
True
:type: `bool`
◆ python_format()
| bool babel.messages.catalog.Message.python_format |
( |
|
self | ) |
|
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`
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/babel/messages/catalog.py