gdm/gdm-2.23.92-another-locale-fixup.patch
Ray Strode e1ea6b93ab - canonicalize codeset to match output of locale -m
- filter duplicates from language list
2008-09-17 15:15:09 +00:00

40 lines
1.2 KiB
Diff

--- gdm/gui/simple-greeter/gdm-languages.c (revision 6468)
+++ gdm/gui/simple-greeter/gdm-languages.c (working copy)
@@ -216,6 +216,25 @@ construct_language_name (const char *lan
return name;
}
+static void
+make_codeset_canonical_for_locale (const *name,
+ const char **codeset)
+{
+ char *old_locale;
+ char *canonical_codeset;
+
+ old_locale = setlocale (LC_CTYPE, name);
+
+ if (old_locale == NULL) {
+ return;
+ }
+
+ g_free (*codeset);
+ *codeset = g_strdup (nl_langinfo (CODESET));
+
+ setlocale (LC_CTYPE, old_locale);
+}
+
char *
gdm_normalize_language_name (const char *name)
{
@@ -234,6 +253,10 @@ gdm_normalize_language_name (const char
&territory_code,
&codeset, &modifier);
+ if (codeset != NULL) {
+ make_codeset_canonical_for_locale (name, &codeset);
+ }
+
normalized_name = construct_language_name (language_code,
territory_code,
codeset, modifier);