[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Still not able to get gettext working - SOLVED
From: |
David Bruce |
Subject: |
Still not able to get gettext working - SOLVED |
Date: |
Sat, 10 Nov 2007 21:58:40 +0000 |
User-agent: |
KMail/1.9.7 |
Hi Bruno and everyone,
I finally determined that the problem was that my program did
not '#include "config.h"' until after '#include "gettext.h"'. It appears
that "config.h" must be included before "gettext.h" for the program to work
correctly. By moving '#include "config.h"' to the top of my "global" header
file, the problem was eliminated. It seems that the #define's in "config.h"
are needed for "gettext.h" to work properly (does that seem plausible?)
I couldn't find mention of this problem in either the gettext manual or the
gettext FAQ, nor via Google - if this ordering requirement is generally true
and not just some quirk of my program or machine, I think it should be in the
documentation.
Below is a stripped-down example:
/***************************************************************/
/* THIS DOES NOT WORK - "config.h" MUST be before "gettext.h", */
/* then it will work properly: */
/***************************************************************/
#include "gettext.h"
#include "config.h"
#include <locale.h>
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
int main(int argc, char * argv[])
{
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
/* --- rest of actual program --- */
return 0;
}
Cheers,
--
David Bruce
- Still not able to get gettext working - SOLVED,
David Bruce <=