mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-10 17:53:17 +00:00
28 lines
865 B
ReStructuredText
28 lines
865 B
ReStructuredText
.. Autogenerated file at 2018-09-08 02:07:37.591007
|
|
|
|
============
|
|
I18n example
|
|
============
|
|
|
|
Internalize your bot
|
|
Step 1: extract texts
|
|
# pybabel extract i18n_example.py -o locales/mybot.pot
|
|
Step 2: create *.po files. For e.g. create en, ru, uk locales.
|
|
# echo {en,ru,uk} | xargs -n1 pybabel init -i locales/mybot.pot -d locales -D mybot -l
|
|
Step 3: translate texts
|
|
Step 4: compile translations
|
|
# pybabel compile -d locales -D mybot
|
|
Step 5: When you change the code of your bot you need to update po & mo files.
|
|
Step 5.1: regenerate pot file:
|
|
command from step 1
|
|
Step 5.2: update po files
|
|
# pybabel update -d locales -D mybot -i locales/mybot.pot
|
|
Step 5.3: update your translations
|
|
Step 5.4: compile mo files
|
|
command from step 4
|
|
|
|
.. literalinclude:: ../../../examples/i18n_example.py
|
|
:caption: i18n_example.py
|
|
:language: python
|
|
:linenos:
|
|
:lines: 22-
|