Hello,
My name is Kizito. I am have volunteered to co-ordinate the provision
of
Linux native language support for Luganda. Please bear with me, this
email is a bit long.
I got involved through using LyX to write a book in that language,
liking the the aplication and wishing to translate it. However I have a
problem, gettext will not pick up any of the '.mo' files produced. I
have written a small program (po-test) to try to understand what is
happening (based on example code found at the website of Christian Reis
- which has some good explanation of gettext). I have placed '.mo'
files
at '/usr/share/locale/lug/LC_MESSAGES/po-test.mo' and
'/usr/lib/locale/lug/LC_MESSAGES/po-test.mo'.
The C-code in the program goes:
#include <libintl.h>
int main() {
setlocale("LC_MESSAGES","lug");
setlocale("LC_CYTPE","");
setlocale("LANG","lug");
bindtextdomain((char *)"po-test","/usr/lib/locale");
textdomain((char *)"po-test");
printf(gettext("Hello World\n"));
printf(gettext("Goodbye Aubergine\n"));
}
The '.po' file content are:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"POT-Creation-Date: 2001-09-19 21:06+0100\n"
"PO-Revision-Date: 2001-09-19 21:13GMT\n"
"Last-Translator: K.Birabwa <[EMAIL PROTECTED]>\n"
"Language-Team: Luganda\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 0.8\n"
#: po-test.c:48
msgid "Hello World\n"
msgstr "Koodi\n"
#: po-test.c:50
msgid "Goodbye Aubergine\n"
msgstr "Mwelaba\n"
This is what happens:
[root@localhost bin]# export LANG="lug"
[root@localhost bin]# echo $LANG
lug
[root@localhost bin]# strace -eopen ./po-test
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/i586/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/lib/i586/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/mmx/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libc.so.6", O_RDONLY) = 3
Hello World
Goodbye Aubergine
This also happens when the line
bindtextdomain((char *)"po-test","/usr/lib/locale");
is replaced by
bindtextdomain((char *)"po-test","/usr/share/locale");
or
bindtextdomain("po-test","/usr/share/locale");
or
bindtextdomain("po-test","/usr/lib/locale");
Troubleshooting:-
Here is the output of the diagnostics I have attempted.
[root@localhost /root]# locale
LANG=en_GB
LC_CTYPE="en_GB"
LC_NUMERIC="en_GB"
LC_TIME="en_GB"
LC_COLLATE="en_GB"
LC_MONETARY="en_GB"
LC_MESSAGES="en_GB"
LC_PAPER="en_GB"
LC_NAME="en_GB"
LC_ADDRESS="en_GB"
LC_TELEPHONE="en_GB"
LC_MEASUREMENT="en_GB"
LC_IDENTIFICATION="en_GB"
LC_ALL=
[root@localhost /root]# strace -eopen ls | grep locale
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/i586/mmx/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/lib/i586/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/lib/mmx/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/lib/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libtermcap.so.2", O_RDONLY) = 3
open("/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/libc.so.6", O_RDONLY) = 3
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_IDENTIFICATION", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_MEASUREMENT", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_TELEPHONE", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_ADDRESS", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_NAME", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_PAPER", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_MESSAGES", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_MONETARY", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_COLLATE", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_TIME", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_NUMERIC", O_RDONLY) = 3
open("/usr/lib/locale/en_GB/LC_CTYPE", O_RDONLY) = 3
open("/dev/null", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = -1 ENOTDIR (Not a
directory)
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
open("/etc/mtab", O_RDONLY) = 3
open("/proc/meminfo", O_RDONLY) = 3
Both '/usr/share/locale' and '/usr/lib/locale' are populated with
similarly named directories. Those in '/usr/share/locale' only contain
LC_MESSAGES, whilst those in '/usr/lib/locale' contain all the files
and
directories searched in the above output for en_GB.
[root@localhost /root]# export LANG="lug"
[root@localhost /root]# echo $LANG
lug
[root@localhost /root]# locale
LANG=lug
LC_CTYPE="lug"
LC_NUMERIC="lug"
LC_TIME="lug"
LC_COLLATE="lug"
LC_MONETARY="lug"
LC_MESSAGES="lug"
LC_PAPER="lug"
LC_NAME="lug"
LC_ADDRESS="lug"
LC_TELEPHONE="lug"
LC_MEASUREMENT="lug"
LC_IDENTIFICATION="lug"
LC_ALL=
[root@localhost /root]# !s
strace -eopen ls | grep locale
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/lib/i586/mmx/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/lib/i586/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/lib/mmx/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("/usr/lib/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libtermcap.so.2", O_RDONLY) = 3
open("/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/libc.so.6", O_RDONLY) = 3
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
open("/usr/lib/locale/lug/LC_IDENTIFICATION", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/dev/null", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = -1 ENOTDIR (Not a
directory)
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
open("/etc/mtab", O_RDONLY) = 3
open("/proc/meminfo", O_RDONLY) = 3
locale.info.txt
The file LC_IDENTIFICATION appears to be important.
Thank you for your patience, I would be pleased for your assistance.
Regards,
Kizito
http://www.kizito.uklinux.net
--