Using Python locale or equivalent in web applications?

前端 未结 4 646
天命终不由人
天命终不由人 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条回答
  •  Happy的楠姐
    2021-02-02 04:04

    Don't use setlocale.

    Check how it is done in django. It looks like they use class api of gettext library and do not use the setlocale function I bet there is a reason for this.

    They manually store a translation per thread check here how it is implemented (gettext function and _active dictionary).

提交回复
热议问题