help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext


From: Roger Leigh
Subject: Re: gettext
Date: Wed, 08 Dec 2004 22:26:53 +0000
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tristan Van Berkom <vantr@touchtunes.com> writes:

>     - In my program I call:
>         setlocale (LC_MESSAGES, "");

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).

>         bindtextdomain ("mydomain", "/hardcoded_path");
>         textdomain (TOUCHTUNES_TEXTDOMAIN);
>
>     - When the user clicks on the "Spanish" button, I call:
>         setlocale (LC_MESSAGES, "spanish");
>       And proceed to update strings in my GUI while ensuring
>       that gettext() is getting called to retrieve the new strings.
>
> You've probably guessed by now that my problem is simply that
> my strings arent getting translated :-(
>
> Any ideas what I'm missing ?

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.

The gettext manual recommends doing this:

            /* Change language.  */
            setenv ("LANGUAGE", "fr", 1);

            /* Make change known.  */
            {
              extern int  _nl_msg_cat_cntr;
              ++_nl_msg_cat_cntr;
            }

Alternatively, you can bypass the caching and force gettext to check
the environment every time you use it by calling dcgettext() instead
of gettext().


Regards,
Roger

- -- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFBt3+sVcFcaSW/uEgRAmZuAJ9tEu238y2TGtQLrmIX1dfxYRKFRwCfeKTe
g4xDW1Cn2ylLFtt5JA+nQf8=
=Oy6z
-----END PGP SIGNATURE-----


reply via email to

[Prev in Thread] Current Thread [Next in Thread]