[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext
From: |
Tristan Van Berkom |
Subject: |
Re: gettext |
Date: |
Thu, 09 Dec 2004 10:36:58 -0500 |
User-agent: |
Mozilla Thunderbird 0.8 (X11/20040913) |
Roger Leigh wrote:
> Are all the required files available in the chroot? Run the program
> with strace, and see if any open() calls fail. Some files will be
> optional, but you may find some data files (e.g. locale stuff) are
> missing.
strace in chroot does this:
================== setlocale(LC_ALL, "") ======================
ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffffa38) = -1 EBADF
(Bad file descriptor)
brk(0x804c000) = 0x804c000
open("/usr/lib/charset.alias", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory)
===============================================================
Anyway, no use printing it all here, the offensive line is:
ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffffa38) = -1 EBADF
Which appears also in bindtextdomain(), textdomain() and dgettext().
the strace of the same program compiled & run outside of the environment
also yields the line:
open("/usr/lib/charset.alias", O_RDONLY|O_LARGEFILE) = -1 ENOENT
So I'm sure that this alias file doesn't need to be present
[...]
setlocale (LC_ALL, "");
is rather more standard, and it will make sure LC_CTYPE etc. are
correctly set up (needed to know the output codeset).
Good point, I ended up trying that out yesterday and, no luck :-(
LC_MESSAGES can be overridden by LANGUAGE and LC_ALL. You might want
to try one of those instead of LC_MESSAGES. Also, gettext caches
strings and only rereads messages if it's notified the environment has
changed.
Ok, but if I setup setlocale(LC_ALL, "") and make sure that there is
no $LANGUAGE in the environment, then LC_MESSAGES should be good,
right ?
In this case, I'm sure that just setting setlocale(LC_ALL, "") is
already broken :-(
Thanks for your input though ;-)
Cheers,
-Tristan
========================= TEST PROGRAM ========================
#include <glib.h>
#include <locale.h>
void main()
{
g_print ("default LC_ALL locale: %s\n", setlocale (LC_ALL, ""));
g_print ("new domain dir: %s\n",
bindtextdomain ("tristan", "/home/vantr/locale"));
g_print ("new domain: %s\n", textdomain ("tristan"));
g_print ("spanish LC_MESSAGES locale: %s\n", setlocale (LC_MESSAGES,
"spanish"));
g_print ("dgettext returns %s\n",
dgettext ("tristan", "english phrase"));
}
===============================================================
- gettext, Tristan Van Berkom, 2004/12/07
- Re: gettext, Tristan Van Berkom, 2004/12/08
- Message not available
- Re: gettext, Roger Leigh, 2004/12/08
- Re: gettext,
Tristan Van Berkom <=