From 20f56fddcd58c84fa73597486e905c652667214f Mon Sep 17 00:00:00 2001 From: Didier Roche Date: Thu, 29 Jan 2015 16:12:58 +0100 Subject: Add gettext support --- src/shared/util.c | 8 ++++++++ src/shared/util.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src/shared') diff --git a/src/shared/util.c b/src/shared/util.c index ba035caed0..deb9839633 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include #include @@ -74,6 +76,7 @@ #include #endif +#include "config.h" #include "macro.h" #include "util.h" #include "ioprio.h" @@ -5782,6 +5785,11 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, return NULL; } +void init_gettext(void) { + setlocale(LC_ALL, ""); + textdomain(GETTEXT_PACKAGE); +} + bool is_locale_utf8(void) { const char *set; static int cached_answer = -1; diff --git a/src/shared/util.h b/src/shared/util.h index a83b588221..45cb09443d 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -737,6 +737,8 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg); +#define _(String) gettext (String) +void init_gettext(void); bool is_locale_utf8(void); typedef enum DrawSpecialChar { -- cgit v1.2.3-54-g00ecf