Skip to content

Documentation is out of date #134

Closed
Closed
@alehuo

Description

@alehuo

Edit: It appeared that the fluent.runtime I installed with pip install fluent.runtime was actually a lot older than what I expected.

When adding messages to Fluent bundles, the documentation at https://fluent-runtime.readthedocs.io/en/latest/index.html states you can directly add the messages as a template string like so:

>>> bundle.add_messages("""
... welcome = Welcome to this great app!
... greet-by-name = Hello, { $name }!
... """)

In reality, you have to wrap the template string into a FluentResource and use bundle.add_resource instead of bundle.add_messages because it does not exist. The add_resource function checks if there is a body key in the resource function parameter, which is generated by the FluentResource class.

from fluent.runtime import FluentBundle, FluentResource

bundle = FluentBundle(['en-us'])
bundle.add_resource(FluentResource("""
welcome = Welcome!
"""))

Also, bundle.format() does not exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions