Why do Django and gettext fail to load my 'zh' translations?
Django's default LANGUAGES
settings contains zh-cn
and zh-tw
. However, I would like to use zh
instead of zh-tw
. I've set up my LANGUAGES
setting appropriately and compiled the gettext messages but Django will only load the zh-cn
translation.
Frustratingly, gettext will 开发者_如何学JAVAload the zh
translation fine if I delete the zh_CN
directory!
Is there any way to get zh
to load the right translation?
My assumption on this is because django itself is only translated into zh-cn and zh-tw. Django translation will only allow you to translate into a language Django itself is translated for.
You should try to translate Django into zh (or copy zh-tw into zh).
Maybe the "Using Gettextize software" from GNU C help.
http://www.gnu.org/software/libc/manual/html_node/Using-gettextized-software.html
Quote:
The file /usr/share/locale/locale.alias (replace /usr with whatever prefix you used for configuring the C library) contains a mapping of alternative names to more regular names. The system manager is free to add new entries to fill her/his own needs. The selected locale from the environment is compared with the entries in the first column of this file ignoring the case. If they match the value of the second column is used instead for the further handling.
Note that the in some system (e.g. Fedora 21), /usr/system/locale/locale.alias
is obsoleted and just for backward compatibility.
精彩评论