common: Try to get the configured language as the current one

This commit is contained in:
Bastien Nocera 2012-11-23 18:44:58 +01:00
parent 781bda8e12
commit 3eb6cdd1bc

View file

@ -34,6 +34,8 @@
#include "gdm-languages.h"
static char *get_lang_for_user_object_path (const char *path);
static gint
cc_common_language_sort_languages (GtkTreeModel *model,
GtkTreeIter *a,
@ -315,8 +317,15 @@ gchar *
cc_common_language_get_current_language (void)
{
gchar *language;
char *path;
const gchar *locale;
path = g_strdup_printf ("/org/freedesktop/Accounts/User%d", getuid ());
language = get_lang_for_user_object_path (path);
g_free (path);
if (language != NULL && *language != '\0')
return language;
locale = (const gchar *) setlocale (LC_MESSAGES, NULL);
if (locale)
language = gdm_normalize_language_name (locale);