我对使用webpy的i18n有点问题。
我关注的是:http://webpy.org/cookbook/i18n_support_in_template_file
因此,在我的.wsgi中有:
#i18n
gettext.install('messages',I18N_PATH,unicode=True)
gettext.translation('messages',I18N_PATH,languages=['fr_FR','en_US']).install(True)所以我跑了:
pygettext.py -a -v -d messages -o i18n/messages.po controllers/*.py views/*.html 我已经复制并翻译了messages.po,我还更改了"content-type“和"content-transfer-encoding:
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: UTF-8\n"然后我运行了这个命令:
msgfmt -v -o i18n/fr_FR/LC_MESSAGES/messages.mo i18n/fr_FR/LC_MESSAGES/messages.po
>>>93 messages traduits.这是i18n文件夹的树状结构:
i18n/:
en_US fr_FR messages.po
i18n/en_US:
LC_MESSAGES
i18n/en_US/LC_MESSAGES:
messages.mo messages.po
i18n/fr_FR:
LC_MESSAGES
i18n/fr_FR/LC_MESSAGES:
messages.mo messages.po但是当我访问我的网站时(我的浏览器语言是"fr_fr"),我还没有翻译这个字符串。
我也不知道为什么。有谁有主意吗?
谢谢
发布于 2011-05-05 03:38:50
web.py文档在这里对其进行了解释。
http://webpy.org/cookbook/runtime-language-switch
https://stackoverflow.com/questions/2999365
复制相似问题