This commit is contained in:
Mahan Safaee 2026-04-04 17:10:08 +00:00 committed by GitHub
commit 6fe4307d49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 4 deletions

View file

@ -113,6 +113,16 @@ On top of your application the instance of :class:`aiogram.utils.i18n.I18n` shou
After that you will need to choose one of builtin I18n middleware or write your own.
When using :class:`aiogram.utils.i18n.middleware.SimpleI18nMiddleware`, locale codes from
Telegram (for example ``pt-br``) are resolved against loaded locales in two steps:
1. Direct match as received from Telegram (``pt-br``)
2. Normalized Babel-style identifier (``pt_BR``)
So if your translations are stored under
``locales/pt_BR/LC_MESSAGES/messages.mo``, they will be selected for users with
``language_code="pt-br"``.
Builtin middlewares: