From 75c0534820958f69731dc3e07d839ad7e18474a4 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 4 Nov 2008 19:54:02 +0000 Subject: Revamped the W32 gettext implementation. --- common/ChangeLog | 7 ++++++- common/homedir.c | 21 +++++++++++++++++++++ common/i18n.c | 2 +- common/util.h | 1 + 4 files changed, 29 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/ChangeLog b/common/ChangeLog index 9e3c450d9..94de8fd26 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,5 +1,10 @@ -2008-10-20 Werner Koch +2008-11-04 Werner Koch + + * i18n.c (i18n_init) [USE_SIMPLE_GETTEXT]: Adjust for changed + w32-gettext.c. + * homedir.c (gnupg_localedir): New. +2008-10-20 Werner Koch * http.c (http_register_tls_callback) [!HTTP_USE_GNUTLS]: Mark unused arg. diff --git a/common/homedir.c b/common/homedir.c index b21646c78..74f3a0d1f 100644 --- a/common/homedir.c +++ b/common/homedir.c @@ -322,6 +322,27 @@ gnupg_datadir (void) } +const char * +gnupg_localedir (void) +{ +#ifdef HAVE_W32_SYSTEM + static char *name; + + if (!name) + { + const char *s1, *s2; + s1 = w32_rootdir (); + s2 = DIRSEP_S "share" DIRSEP_S "locale"; + name = xmalloc (strlen (s1) + strlen (s2) + 1); + strcpy (stpcpy (name, s1), s2); + } + return name; +#else /*!HAVE_W32_SYSTEM*/ + return LOCALEDIR; +#endif /*!HAVE_W32_SYSTEM*/ +} + + /* Return the default socket name used by DirMngr. */ const char * dirmngr_socket_name (void) diff --git a/common/i18n.c b/common/i18n.c index daa147faa..db5ddf5f8 100644 --- a/common/i18n.c +++ b/common/i18n.c @@ -33,7 +33,7 @@ void i18n_init (void) { #ifdef USE_SIMPLE_GETTEXT - set_gettext_file (PACKAGE_GT, "Software\\GNU\\GnuPG"); + bindtextdomain (PACKAGE_GT, gnupg_localedir ()); #else # ifdef ENABLE_NLS setlocale (LC_ALL, "" ); diff --git a/common/util.h b/common/util.h index b21e9283d..29955a494 100644 --- a/common/util.h +++ b/common/util.h @@ -208,6 +208,7 @@ const char *gnupg_bindir (void); const char *gnupg_libexecdir (void); const char *gnupg_libdir (void); const char *gnupg_datadir (void); +const char *gnupg_localedir (void); const char *dirmngr_socket_name (void); /* All module names. We also include gpg and gpgsm for the sake for -- cgit v1.2.3