i know the {% trans %} is for translation,
and how can i translate {% trans “This is the title.” %} to chinese.
thanks
D:\zjm_code\register2>python D:\Python25\Lib\site-packages\django\bin\django-adm
in.py compilemessages
processing file django.po in D:\zjm_code\register2\locale\cn\LC_MESSAGES
msgfmt: iconv failure
You don’t follow the documentation?
3 steps:
Add
{% load i18n %}in the template (as Michał Ludwiński says). Put the{% trans %}in your templates, or_in python code, etc.Build a translation dictionary:
Run
django-admin.py makemessages -l cn(cn = China language code) in your Django project root.Edit
locale/cn/LC_MESSAGES/django.po. Just undermsgid "Hello!"changemsgstr ""to tomsgstr "nihao". Don’t changemsgid. You can use unicode, but I’d use pinyin until you are sure everything else works.Run
django-admin.py compilemessagesSetup language translation. You might need to enable some middle-ware.