AIX7.1 gettext无法在LANG=zh_CN.utf8正常工作
写一简单脚本程序, 如下:#!/bin/sh
echo `gettext "Please try thisn"`
将此存入testzhcn.sh
然后, 用
# xgettext -d testzhcn testzhcn.sh
产生 testzhcn.po
将该文件中的CHARSET替换成UTF-8, 然后将与msgid对等的中文放入msgstr中, 接着, 运行
# msgfmt -o testzhcn.mo testzhcn.po
然后,把这个testzhcn.mo放到系统locale/zh_CN/LC_MESSAGES/目录下.
修改testzhcn.sh为:
#!/bin/sh
echo `gettext testzhcn "Please try thisn"`
# chmod +x testzhcn.sh
# export LANG
# LANG=zh_CN.utf8
# ./testzhcn.sh
但显示的仍然是原有的英文.
用truss可以看到这进程找到了testzhcn.mo文件, 但还是无法了解为何无法得到这中文的翻译.