1. install gettext
sudo apt-get install gettext
2. write a python code named "gettext.py"
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from gettext import gettext as _
print _('Hello!')
3. get .pot file from .py file
pygettext -o gettext.pot gettext.py
4. cp gettext.pot to gettext.po5. nano gettext.po
change "Content-Type: text/plain; charset=CHARSET\n"
to "Content-Type: text/plain; charset=utf-8\n"
change "Content-Transfer-Encoding: ENCODING\n"
to "Content-Transfer-Encoding: utf-8\n"
to "Content-Type: text/plain; charset=utf-8\n"
change "Content-Transfer-Encoding: ENCODING\n"
to "Content-Transfer-Encoding: utf-8\n"
msgid "Hello!"
msgstr "哈羅!"
6. msgfmt -o gettext.mo gettext.po
7. mkdir zh_TW.big5/LC_MESSAGES
8. mv gettext.mo zh_TW.big5/LC_MESSAGES/
9. python getteext.py
5 意見:
看不太懂!!!
但還是謝謝你的分享!
感謝你的分享捏!!
幫助很多喔!!
有點不清楚
但還是感謝分享啦
好深奧@@還是謝謝分享^^
完全不懂@@
張貼留言