Fallback to default language if string isn't available in i18n
- Dominant language
- Python
- Stars
- 5.9k
- Forks
- 963
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 4
Description
### aiogram version
3.x
### Problem
Currently, if for a language a string is missing, it shows the key of that string.
### Possible solution
Instead of showing the key of the string, to get the default language's string and use that instead.
### Alternatives
```python3
FSMI18nMiddleware(i18n := I18n(path="locales", default_locale="en")).setup(dp)
default_locale = i18n.locales[i18n.default_locale]
for locale in i18n.locales.values():
if locale is not default_locale:
locale.add_fallback(default_locale)
```
### Code example
```python3
# lang = en (default language)
text = _("message.hello") # Hello!
# lang = ru (not 100%d language)
text = _("message.hello") # message.hello
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.