开发者

python django Localization

开发者 https://www.devze.com 2023-02-28 14:52 出处:网络
I\'m using django Internationalization current now. When i use in template such as {% trans \"i love you\" %}

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

精彩评论

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