__init__.py |
|
269 |
parse.py |
Parse a .ftl file into a message resource.
Message and term references are represented by `message` function annotations,
with term identifiers prefixed with a `-`.
By default, messages are parsed as Messages;
to keep them as Fluent Patterns, use `as_ftl_patterns=True`.
Function names are lower-cased, so e.g. the Fluent `NUMBER` is `number` in the Resource.
The parsed resource will not include any metadata.
|
13822 |
serialize.py |
Serialize a resource as the contents of a Fluent FTL file.
Section identifiers are not supported.
Single-part message identifiers are treated as message values,
while two-part message identifiers are considered message attributes.
Function names are upper-cased, and annotations with the `message` function
are mapped to message and term references.
Yields each entry and comment separately.
If the resource includes any metadata, a `serialize_metadata` callable must be provided
to map each field into a comment value, or to discard it by returning an empty value.
|
13806 |