python-babel / flask-babel

i18n and l10n support for Flask based on Babel and pytz
https://python-babel.github.io/flask-babel/
Other
444 stars 159 forks source link

New context manager: force_timezone() #123

Closed fabfuel closed 5 years ago

fabfuel commented 7 years ago

As useful as forcing a specific locale, it is useful to be able to enforce a specific timezone.

In my case, I want to render a template for a specific user who has a preferred timezone, but this is not a logged in user, why it would be too complicated to implement this via a request context aware timezoneselector.

The implementation and behaviour of force_timezone() is similar to the existing context manager force_locale().

rnd0101 commented 6 years ago

Does this repeats the same mistake as force_locale, which makes this useless in multi-threading environment?