Locales mini-HOWTO: catopen bug fix.

prev-1983945 next-2994553 toc-4535813

Installing the locales fixes a bug (feature ?) that is in the catopen command in Linux libc. Say you create a program that uses message catalogs, and you create an German catalog and put it in /home/peeter/catalogs/de_DE.

Now upon doing the following, without the de_DE locale installed :


export LC_MESSAGES=de_DE
export NLSPATH=/home/peeter/catalogs/%L/%N.cat:$NLSPATH

the German message catalog does not get opened, and the default messages in the catgets calls are used.

This is because catopen does a setlocale call to get the right message category, the setlocale fails even though the environment variable has been set. catopen then attempts to load the message catalog substituting « C » for all the « %L »‘s in the NLSPATH.

You can still use your message catalog without installing the locale, but you would have to explicitly set the « %L » part of the NLSPATH like


export NLSPATH=/home/peeter/catalogs/de_DE/%N.cat:$NLSPATH

, but this defeats the whole purpose of the locale catagory environment variables.prev-1983945 next-2994553 toc-4535813

READ  HP hardware supported by Linux