You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless the use monkey patch the current_translation will always be english:
in utils.py the way the current locale is detect is this line:
locale=i18n.get_locale()
If you lookup what this does in sqlalchemy_utils/i18n.py you
find this function simply returns the babel.Locale in English
try:
returnbabel.Locale('en')
So the documentation should at least make it clear you need to monkey patch this behavior and I would also remove the dependency on this function and make it simpler how to pass your own locale detection given that there is no universal solution.
For those searching for a solution, here is how you can get it to work for Flask + Flask-Babel
Unless the use monkey patch the current_translation will always be english:
in utils.py the way the current locale is detect is this line:
If you lookup what this does in sqlalchemy_utils/i18n.py you
find this function simply returns the
babel.Locale
in EnglishSo the documentation should at least make it clear you need to monkey patch this behavior and I would also remove the dependency on this function and make it simpler how to pass your own locale detection given that there is no universal solution.
For those searching for a solution, here is how you can get it to work for Flask + Flask-Babel
The text was updated successfully, but these errors were encountered: