Skip to content

Commit 10b5886

Browse files
committed
Completed I18N examples descriptions
1 parent 93b97fc commit 10b5886

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

  • examples
    • asynchronous_telebot/middleware/i18n_middleware_example
    • i18n_class_example

‎examples/asynchronous_telebot/middleware/i18n_middleware_example/main.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
pybabel update -i locales/{domain_name}.pot -d locales
4242
- translate
4343
pybabel compile -d locales
44+
45+
If you have any exceptions check:
46+
- you have installed babel
47+
- translations are ready, so you just compiled it
48+
- in the commands above you replaced {domain_name} to messages
49+
- you are writing commands from correct path in terminal
4450
"""
4551

4652
import asyncio
@@ -81,7 +87,7 @@ async def get_user_language(self, obj: Union[types.Message, types.CallbackQuery]
8187

8288

8389
storage = StateMemoryStorage()
84-
bot = AsyncTeleBot("1254795383:AAE7gbj1aas4lEDHB1eVuZZhSGPWcH1B5ds", state_storage=storage)
90+
bot = AsyncTeleBot("", state_storage=storage)
8591

8692
i18n = I18NMiddleware(translations_path='locales', domain_name='messages')
8793
_ = i18n.gettext # for singular translations

‎examples/i18n_class_example/main.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
pybabel update -i locales/{domain_name}.pot -d locales
4242
- translate
4343
pybabel compile -d locales
44+
45+
If you have any exceptions check:
46+
- you have installed babel
47+
- translations are ready, so you just compiled it
48+
- in the commands above you replaced {domain_name} to messages
49+
- you are writing commands from correct path in terminal
4450
"""
4551

4652
from functools import wraps

0 commit comments

Comments
 (0)