[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext and C usage
From: |
Bruno Haible |
Subject: |
Re: gettext and C usage |
Date: |
Mon, 25 Feb 2002 19:43:09 +0100 (CET) |
Karl Berry writes:
> I wonder if the gettext manual could include the recommended constructs
> to declare gettext from a .h file. (At least I couldn't find such.)
It does so at several places.
> For Texinfo, I'm currently using:
>
> #ifdef HAVE_LOCALE_H
> #include <locale.h>
> #endif
Plain "#include <locale.h>" is sufficient. Systems without <locale.h>
file are not in use anymore.
> #ifndef HAVE_SETLOCALE
> #define setlocale(category,locale) /* empty */
> #endif
Likewise, not needed. All systems have this function.
> /* For gettext (NLS). */
> #include "gettext.h"
OK.
> #if !HAVE_LC_MESSAGES
> # define LC_MESSAGES (-1)
> #endif
Not needed. If <locale.h> doesn't define LC_MESSAGES, <libintl.h> will
do so. <libintl.h> is included by "gettext.h".
> #define _(String) gettext (String)
> #define N_(String) (String)
Right. If you are building a library, not a program, then
#define _(String) dgettext ("my-library-name", String)
is to be preferred.
Bruno