From 1194f42d5aca06edb8850a93c06b234090228449 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 7 Apr 2004 16:53:55 +0000 Subject: [PATCH] (my_dgettext): Switch the codeset once to utf-8. Allow building with out NLS. --- tools/ChangeLog | 5 +++++ tools/gpgconf-comp.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/ChangeLog b/tools/ChangeLog index a9bd5fba5..0a4046cbd 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,8 @@ +2004-04-07 Werner Koch + + * gpgconf-comp.c (my_dgettext): Switch the codeset once to utf-8. + Allow building with out NLS. + 2004-03-23 Marcus Brinkmann * gpgconf-comp.c (gc_options_dirmngr): Set GC_OPT_FLAG_ARG_OPT for diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index fa755afe0..0b56129c1 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -855,16 +855,31 @@ gpg_agent_runtime_change (void) } -/* Robust version of dgettext. */ +/* More or less Robust version of dgettext. It has the sidefeect of + switching the codeset to utf-8 becuase this is what we want to + output. In theory it is posible to keep the orginal code set and + switch back for regular disgnostic output (redefine "_(" for that) + but given the natur of this tool, being something invoked from + other pograms, it does not make much sense. */ static const char * my_dgettext (const char *domain, const char *msgid) { +#ifdef ENABLE_NLS if (domain) { - char *text = dgettext (domain, msgid); + static int switched_codeset; + char *text; + + if (!switched_codeset) + { + bind_textdomain_codeset (PACKAGE_GT, "utf-8"); + switched_codeset = 1; + } + text = dgettext (domain, msgid); return text ? text : msgid; } else +#endif return msgid; }