Skip to main content

Fluent Telegrinder

Fluent i18n implementation for telegrinder

uv Ruff Python versions Project version

💖 Part of Awesome Telegrinder

Usage

pip install fluent-telegrinder

CLI

# Pre-compile .ftl files into .ftlc (pickled AST) for faster startup:
ftl-compile locales/

# Write compiled files to a separate directory:
ftl-compile locales/ --output locales_compiled/

# Force overwrite existing .ftlc files:
ftl-compile locales/ --force

Then enable compiled loading in your config:

config = FluentConfig(
    folder="locales/",
    source=DefaultLocaleSource,
    use_compiled=True,  # loads .ftlc files, falls back to .ftl if absent
)
from telegrinder import API, Message, Telegrinder, Token

from fluent_telegrinder import (
    DefaultLocaleSource,  # / UserLanguageSource 
    FluentConfig,
    Translator,
    TextEquals,
)

config = FluentConfig(
    folder="locales/",
    source=DefaultLocaleSource, # any node that returns str - source for locale
    default_locale="ru",
    replace_underscore=True, # i_love_telegrinder -> i-love-telegrinder
)
Translator.configure(config)

bot = Telegrinder(API(Token.from_env()))

@bot.on.message(TextEquals("hello", ignore_case=True)) # hello - i18n key (hello, привет)
async def on_hello(msg: Message, _: Translator):
    await msg.reply(_.hello_answer(user=msg.from_user.first_name))

bot.run_forever(skip_updates=True)

License

Fluent Telegrinder is MIT licensed.

Metadata

Release files for fluent-telegrinder 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluent-telegrinder 1.1.0
File Size Uploaded Provenance Actions
fluent_telegrinder-1.1.0.tar.gz 8.8 kB Without provenance Details for fluent_telegrinder-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fluent-telegrinder 1.1.0
File Interpreter ABI Platform Actions
fluent_telegrinder-1.1.0-py3-none-any.whl Python 3 none any Details for fluent_telegrinder-1.1.0-py3-none-any.whl

Total release size: 18.1 kB

Release files / fluent_telegrinder-1.1.0.tar.gz

Download URL fluent_telegrinder-1.1.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9a187b7681543f8b9ca8e3e15fb76cf829725cd4c03c31644c7c6598471f8641
BLAKE2b-256 checksum
How to use checksums
8f7f901c99f6bd322b440afede2acf43e3814eb8e93b233b724e5e923aec607d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / fluent_telegrinder-1.1.0-py3-none-any.whl

Download URL fluent_telegrinder-1.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb85dda711677d16b5d6293bf8df9fe5ddad136c244b5a78a3bf9c8aa98b470d
BLAKE2b-256 checksum
How to use checksums
15f0f1635c8fe22e9062d2cccfd94668ee2d213f94b69b50c7bf8ce97ede062c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for fluent-telegrinder 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page