Using Python locale or equivalent in web applications?

前端 未结 4 584
天命终不由人
天命终不由人 2021-02-02 03:36

Python\'s locale implementation seems to want to either read the locale from system settings or have it be set via a setlocale call. Neither of these work for me since I\'d like

4条回答
  •  暖寄归人
    2021-02-02 04:20

    Django's i18n framework works out the shortcomings of setlocale() by not using it. This way the locale is set per request and if you use LocaleMiddleware it can be set to change according to UserAgent Accept-Language setting. See the docs.

提交回复
热议问题