From 57d76d9b31a0ff48f2134d11737818a74fdf6c8a Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 26 Nov 2002 17:20:16 +0000 Subject: If the language is something like "fr_FR", return both "fr_FR" and "fr" in * e-lang-utils.c (e_get_language_list): If the language is something like "fr_FR", return both "fr_FR" and "fr" in the list. Oaf doesn't consider "fr_FR" to match a "-fr" translation. svn path=/trunk/; revision=18926 --- e-util/e-lang-utils.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'e-util/e-lang-utils.c') diff --git a/e-util/e-lang-utils.c b/e-util/e-lang-utils.c index 3516531eb3..649a8cc887 100644 --- a/e-util/e-lang-utils.c +++ b/e-util/e-lang-utils.c @@ -32,8 +32,10 @@ GSList * e_get_language_list (void) { + GSList *list = NULL; const char *env; const char *p; + char *lang; env = g_getenv ("LANGUAGE"); if (env == NULL) { @@ -44,15 +46,24 @@ e_get_language_list (void) p = strchr (env, '='); if (p != NULL) - return g_slist_prepend (NULL, (void *) (p + 1)); - else - return g_slist_prepend (NULL, (void *) env); + env = p; + + list = g_slist_prepend (list, g_strdup (env)); + + p = strchr (env, '_'); + if (p != NULL) + list = g_slist_prepend (list, g_strndup (env, p - env)); + + return list; } void e_free_language_list (GSList *list) { - g_return_if_fail (list != NULL); + GSList *iter; + + for (iter = list; iter; iter = iter->next) + g_free (iter->data); g_slist_free (list); } -- cgit