1. create the sample program (/hello.c/)
2. create the template file (/hello.pot/) by:
xgettext -d hello -s -o hello.pot hello.c
3. create the PO file (/chi.po/) by:
msginit -l zh_CN.utf8 -o chi.po -i hello.pot
4. create the MO file (/hello.mo/) by:
msgfmt -c -v -o hello.mo chi.po
5. copy the MO file to the directory LC_MESSAGES under its locale
cp hello.mo ./zh_CN.utf8/LC_MESSAGES *OR*
cp hello.mo ./zh_CN/LC_MESSAGES 6. set the current locale to
*Chinese*
export LANG=zh_CN.utf8
I guess my .mo file has already been put
correctly, right ?
In the main program, the second arg. for bindtextdomain is
"/nfshome/bleung/tmp/GetText".
And, I have tried to copy the .mo file to <second
arg>/zh_CN.utf8/LC_MESSAGES or <second arg>/zh_CN/LC_MESSAGES,
where zh_CN.utf8 is the locale.
7. compile the sample program
cc -I/usr/local/share/gettext hello.c -o hello
8. execute /hello/
./hello
9. result -> *Hello* (NOT translated !)
I have tried to use 'strace' after setting the
variable LANG to zh_CN.utf8.
Here below is the result:
export LANG=zh_CN.utf8
strace 28 all all
*Message catalog can't be opened/accessed for language zh_CN.utf8.
Language C will used*.
_Conclusion:_ What should be checked in order to ensure the right message
catalog can
be accessed ?