[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU gettext & Etrax
On Monday 15 March 2004 19:38, Pieter Grimmerink wrote:
> On Monday 15 March 2004 18:57, Pieter Grimmerink wrote:
> > setlocale(LC_ALL, "") fails (returns NULL pointer)
For whomever is interested, I've finally got gettext + locales working on the
I've done a lot of strace's on my development PC, to find out what files were
opened by gettext / setlocale etc.
There usually is a locale database /usr/lib/locale/locale-archive, which you
really don't want to copy to the Etrax environment.
On my system it is 19MB, and when I tried to create a new one, with just one
locale in it (with localedef), it already was 1.1MB.
After this archive has been read, all subdirs in /usr/lib/locale are scanned,
each of them can store a locale definition.
You can create a locale definition in a subdir, rather then in the archive,
localedef -c -i nl_NL /usr/lib/locale/nl_NL (I'll use nl_NL as an example)
This creates some rather big LC_* files in /usr/lib/locale/nl_NL/
Each of them is required when you do
setlocale(LC_ALL, "") , even if only one of them is missing, the locale is not
But I discovered that
only requires /usr/lib/locale/nl_NL/LC_MESSAGE, which is a subdir with a
system message file in it.
Luckily, this file is very small (only 54 bytes in my example).
And this is all that's needed to make gettext switch to the nl_NL messages.
Now in the devboard_82, glibc is installed in /lib, so also the locale stuff
has to be in /lib/locale rather then /usr/lib/locale.
So I created several locales in /lib/locale, and now I can select different
languages with setlocale(LC_MESSAGE, "xx_XX")