From c578efb32b57b08275b9a0a2fd4a76b4e4b9e87d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 23 Jul 2011 16:38:37 +0200 Subject: Refactor gettext init Put the gettext init code in a macro and define it appropriately depending on whether gettext is actually available or not. --- src/gettext.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gettext.h') diff --git a/src/gettext.h b/src/gettext.h index e74b4eb96..751b83774 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -1,21 +1,21 @@ -#ifdef GETTEXT_FOUND -#ifdef USE_GETTEXT +#if defined(GETTEXT_FOUND) && defined(USE_GETTEXT) #include #else #define gettext(String) String -#define bindtextdomain(domain, dir) /* */ -#define textdomain(domain) /* */ -#endif -#else -#define gettext(String) String -#define bindtextdomain(domain, dir) /* */ -#define textdomain(domain) /* */ #endif #define _(String) gettext(String) #define gettext_noop(String) String #define N_(String) gettext_noop (String) +inline void init_gettext(const char *path) { +#if USE_GETTEXT + setlocale(LC_MESSAGES, ""); + bindtextdomain(PROJECT_NAME, path); + textdomain(PROJECT_NAME); +#endif +} + inline wchar_t* chartowchar_t(const char *str) { size_t l = strlen(str)+1; -- cgit v1.2.3 From e034f8a2a372279edfc5a6c69dc14fb31c9a7685 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 24 Jul 2011 13:58:51 +0200 Subject: Sanitize GETTEXT usage macros Now the user-level option is called ENABLE_GETTEXT, and USE_GETTEXT is only set to true if gettext was enabled and found. This simplifies all check to USE_GETTEXT only rather than the double checks for it being enabled and found. --- src/gettext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gettext.h') diff --git a/src/gettext.h b/src/gettext.h index 751b83774..7c3a6ffab 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -1,4 +1,4 @@ -#if defined(GETTEXT_FOUND) && defined(USE_GETTEXT) +#if USE_GETTEXT #include #else #define gettext(String) String -- cgit v1.2.3