| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Resolve user locale by checking the Telegram language code as-is, then its Babel-normalized form, then the base language. This fixes lowercase regional codes such as pt-br failing to match available translations like pt_BR. Add tests covering region-code variants and fallback behavior, and update i18n documentation plus changelog notes.
✔️ Changelog found.Thank you for adding a description of the changes |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
Add source_locale parameter to aiogram.utils.i18n.I18n and handle it in aiogram.utils.i18n.middleware.SimpleI18nMiddleware.
When source_locale is set (defaults to default_locale), and the user's language matches it, gettext() returns the original untranslated text even if the source locale is not compiled into a .mo file.
Previously, a user with language_code matching the source language (e.g. "en") would receive the default_locale text instead of the original, because the middleware fell back to default_locale when the source locale was not found in compiled locales.
Fixes #733.
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: