Commit 4eecd9b4 authored by Jehan's avatar Jehan
Browse files

Bug 576910: small fix on "Show 'Language' setting languages in native language"

glib's g_getenv() doc says: "The returned string may be overwritten by
the next call to g_getenv(), g_setenv() or g_unsetenv()". And I do
g_setenv() calls just after, while I wish to keep the value intact.

As a consequence, even though the previous commit seemed to work just fine,
I duplicate the return value of g_getenv(), just to be on the safe side.
parent f6dcde1e
......@@ -195,12 +195,12 @@ gimp_language_store_self_l10n (GimpLanguageStore *store,
if (lang && *lang && code && *code)
{
const gchar *semicolon;
const gchar *current_lang = g_getenv ("LANGUAGE");
/* English does not need localization. */
if (g_strcmp0 (code, "en") != 0)
{
gchar *temp_lang;
gchar *current_lang = g_strdup (g_getenv ("LANGUAGE"));
gchar *temp_lang;
if (current_lang)
temp_lang = g_strdup_printf ("%s:%s:%s", code, current_lang, setlocale (LC_ALL, NULL));
......@@ -214,6 +214,7 @@ gimp_language_store_self_l10n (GimpLanguageStore *store,
g_setenv ("LANGUAGE", current_lang, TRUE);
setlocale (LC_ALL, "");
g_free (current_lang);
g_free (temp_lang);
}
......
......@@ -83,8 +83,8 @@ gimp_translation_store_init (GimpTranslationStore *store)
static void
gimp_translation_store_constructed (GObject *object)
{
const gchar *current_lang = g_getenv ("LANGUAGE");
GimpTranslationStore *store = GIMP_TRANSLATION_STORE (object);
gchar *current_lang = g_strdup (g_getenv ("LANGUAGE"));
gchar *label;
G_OBJECT_CLASS (parent_class)->constructed (object);
......@@ -103,6 +103,8 @@ gimp_translation_store_constructed (GObject *object)
setlocale (LC_ALL, NULL));
g_setenv ("LANGUAGE", current_lang, TRUE);
setlocale (LC_ALL, "");
g_free (current_lang);
GIMP_LANGUAGE_STORE_CLASS (parent_class)->add (GIMP_LANGUAGE_STORE (store),
label,
NULL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment