开发者

python django Localization

I'm using django Internationalization current now. When i use in template such as

{% trans "i love you" %}

it works fine.

But when i define it in python file

_("i love you")

it still outputs the Engl开发者_运维问答ish word.

If I replace _("i love you") with "我爱你", it says:

   SyntaxError: Non-ASCII character '\xe4'


you shouldn't replace _("i love you") in your views.py but in the .po file generated by django-admin.py compilemessages (see here).

hope it helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜