开发者

Can't get Django format localization working

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜