From a63368b8b3dbf52d34d37ccd5e6e346bfec71b78 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Tue, 1 Jul 2008 18:29:47 -0700 Subject: [PATCH] Set GPGME locale on first attempt to create context. Closes #2913. --- crypt-gpgme.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 670be1687..adfc50e2b 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -82,6 +82,11 @@ #define CRYPT_KV_STRONGID 8 #define CRYPT_KV_MATCH (CRYPT_KV_ADDR|CRYPT_KV_STRING) +/* static local variables */ +#ifdef ENABLE_NLS +static int GpgmeLocaleSet = 0; +#endif + /* * Type definitions. */ @@ -339,6 +344,16 @@ static gpgme_ctx_t create_gpgme_context (int for_smime) gpgme_error_t err; gpgme_ctx_t ctx; +#ifdef ENABLE_NLS + if (!GpgmeLocaleSet) + { + gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); + gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); + + GpgmeLocaleSet = 1; + } +#endif + err = gpgme_new (&ctx); if (err) { -- 2.40.0