Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set source i18n language #733

Open
Olegt0rr opened this issue Oct 15, 2021 · 0 comments
Open

Set source i18n language #733

Olegt0rr opened this issue Oct 15, 2021 · 0 comments
Labels
enhancement Make it better!

Comments

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Oct 15, 2021

Prerequisites

Code example

text = _("Hello")  # source lang is 'EN'

Project tree

...
locales
├── bot.pot
├── ru
│   └── LC_MESSAGES
│       └── bot.po
├── uk
│   └── LC_MESSAGES
│       └── bot.po
...

Middleware setup

i18n = I18nMiddleware(I18N_DOMAIN, LOCALES_DIR, default="ru", source="en")  

Problem

For this case we should create empty 'en' translation.
If we ignore it, i18n returns default language, cause locale is not in locales.

Suggestion

Add home or source or similar named param to set a source language.
If user.language is "en", i18n shouldn't translate anything, just return an original text.

@Olegt0rr Olegt0rr added the enhancement Make it better! label Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Make it better!
Projects
None yet
Development

No branches or pull requests

1 participant