Fluent i18n implementation for telegrinder
Project description
Fluent Telegrinder
Fluent i18n implementation for telegrinder
Installation:
pip install fluent-telegrinder
Usage:
from telegrinder import API, Message, Telegrinder, Token
from telegrinder.node import as_node
from fluent_telegrinder import (
DefaultLocaleSource, # UserLanguageSource or custom source (any node, returns str)
FluentConfig,
FluentTranslator, # or alias: Translator
TextEquals,
)
config = FluentConfig(
folder="locales/",
source=as_node(DefaultLocaleSource), # source for locale
default_locale="ru",
replace_underscore=True, # i_love_telegrinder -> i-love-telegrinder
)
FluentTranslator.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, _: FluentTranslator):
await msg.reply(_.hello_answer(user=msg.from_user.first_name))
bot.run_forever(skip_updates=True)
License
Fluent Telegrinder licensed under MIT license
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluent_telegrinder-1.0.3.tar.gz.
File metadata
- Download URL: fluent_telegrinder-1.0.3.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c98697e8cd96f78ec0ae75bd3540ae86ab76e7766e7bb0c0d9cc275af7f174f
|
|
| MD5 |
445919fd150b4ddf1d036558399affc7
|
|
| BLAKE2b-256 |
5ad3a3b5867443796f03c6d6a5d675200de19b1525c92ae4d1f3626814fa4361
|
File details
Details for the file fluent_telegrinder-1.0.3-py3-none-any.whl.
File metadata
- Download URL: fluent_telegrinder-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20043ef882c9c44d1d2c4d66b40e58559de92ffb8af089aec107521b7cc97586
|
|
| MD5 |
923747495d58b5581ef2b1d91c440079
|
|
| BLAKE2b-256 |
d7a7fb889a7a08611f50949455f67823dad232b5d2c5c42c3012f71fa3f1e8c1
|