开发者

Can't get Django format localization working

开发者 https://www.devze.com 2023-01-05 08:52 出处:网络
I am trying out Django 1.2\'s spiffy new localization feature. settings.py USE_L10N = True LANGUAGE_CODE = \'sv-SE\'

I am trying out Django 1.2's spiffy new localization feature.

settings.py

    USE_L10N = True
    LANGUAGE_CODE = 'sv-SE'

sometemplate.html

    {{32.519823}}

Is rendered as: 32.519823

In Sweden, the decimal separator should be (, comma) not (. period开发者_如何学JAVA). Am I missing something?


In answer to my own question, it's because DECIMAL_SEPARATOR is defined as '.' in formats.py for the sv locale (incorrectly, IMHO).

To solve this I overrided FORMAT_MODULE_PATH using this reference. Thanks to Brandon in #django for helping me.

0

精彩评论

暂无评论...
验证码 换一张
取 消