Add gettext support

This commit is contained in:
Didier Roche 2015-01-29 16:12:58 +01:00 committed by Martin Pitt
parent 07f9a21b6d
commit 20f56fddcd
3 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,7 @@ AS_IF([test -z "$INTLTOOL_POLICY_RULE"], [
GETTEXT_PACKAGE=systemd
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [systemd])
AC_PROG_MKDIR_P
AC_PROG_LN_S

View File

@ -25,6 +25,8 @@
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <syslog.h>
#include <sched.h>
@ -74,6 +76,7 @@
#include <sys/auxv.h>
#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;

View File

@ -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 {