--- gdm-2.22.0/data/Makefile.am.orig	2008-06-03 17:11:58.201468000 +0900
+++ gdm-2.22.0/data/Makefile.am	2008-06-03 17:13:26.826815000 +0900
@@ -42,6 +42,9 @@ schemasdir = $(gdmconfdir)
 schemas_in_files = gdm.schemas.in
 schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
 
+localealiasdir = $(datadir)/gdm
+localealias_DATA = locale.alias
+
 gdm.schemas.in: $(srcdir)/gdm.schemas.in.in
 	sed	-e 's,[@]GDMPREFETCHCMD[@],$(GDMPREFETCHCMD),g' \
 		-e 's,[@]GDM_CUSTOM_CONF[@],$(GDM_CUSTOM_CONF),g' \
@@ -73,6 +76,7 @@ EXTRA_DIST =			\
 	$(schemas_in_files)	\
 	$(schemas_DATA)		\
 	$(dbusconf_DATA)	\
+	$(localealias_DATA)	\
 	gdm.schemas.in.in	\
 	gdm.conf-custom.in 	\
 	Xsession.in 		\
--- gdm-2.22.0/data/locale.alias.orig	2008-06-03 17:08:03.247221000 +0900
+++ gdm-2.22.0/data/locale.alias	2008-06-03 17:09:34.422319000 +0900
@@ -0,0 +1,15 @@
+# NOTE! This is a broken way to do things.  Gdm currently reads languages ONLY
+# from this file.  This is Broken(tm).  This setup will be replaced in some
+# future version to be replaced by some automatic detection of available
+# locales.  This file is not really a locale.alias file and the first word
+# is used as a label in case gdm doesn't know this language personally,
+# else it's ignored.
+#
+# The format of this file is SIMILAR (but not the same to the locale.alias
+# format).  You could however point gdm at a real locale.alias and it would
+# still concievably work.  Note that the first word cannot contain any spaces.
+# The second word can be a comma separated list of locales to try.  GDM will
+# try if each locale exists and only if it does will it show that locale.  The
+# list is tried in order and the first working one is used.
+#
+#Unspecified   C,POSIX
--- gdm-2.22.0/gui/simple-greeter/gdm-language-chooser-widget.c.orig	2008-06-02 20:47:34.964956000 +0900
+++ gdm-2.22.0/gui/simple-greeter/gdm-language-chooser-widget.c	2008-06-02 23:53:13.392517000 +0900
@@ -181,7 +181,9 @@ add_available_languages (GdmLanguageChoo
         language_names = gdm_get_all_language_names ();
 
         for (i = 0; language_names[i] != NULL; i++) {
-                if (!language_has_font (language_names[i])) {
+                if (!language_has_font (language_names[i]) &&
+                    strcmp ("C", language_names[i]) &&
+                    strcmp ("POSIX", language_names[i])) {
                         continue;
                 }
                 gdm_language_chooser_widget_add_language (widget,
--- gdm-2.22.0/gui/simple-greeter/gdm-languages.c.orig	2008-06-02 20:06:51.361091000 +0900
+++ gdm-2.22.0/gui/simple-greeter/gdm-languages.c	2008-06-10 22:13:31.116263000 +0900
@@ -45,7 +45,7 @@
 #endif
 #include "locarchive.h"
 
-#define ALIASES_FILE LIBLOCALEDIR "/locale.alias"
+#define ALIASES_FILE DATADIR "/gdm/locale.alias"
 #define ARCHIVE_FILE LIBLOCALEDIR "/locale-archive"
 #define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
 #define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
@@ -168,13 +168,7 @@ gdm_parse_language_name (const char *nam
                         *codesetp = NULL;
                 }
 
-                if (*codesetp != NULL) {
-                        char *codeset;
-
-                        codeset = normalize_codeset (*codesetp);
-                        g_free (*codesetp);
-                        *codesetp = codeset;
-                }
+                /* Normalized names causes a failure of setlocale(). */
         }
 
         if (modifierp != NULL) {
@@ -325,46 +319,27 @@ add_locale (const char *language_name)
 {
         GdmLocale *locale;
         GdmLocale *old_locale;
-        char      *name;
-
-        if (language_name_is_utf8 (language_name)) {
-                name = g_strdup (language_name);
-        } else {
-                name = g_strdup_printf ("%s.utf8", language_name);
 
-                if (!language_name_is_utf8 (name)) {
-                        g_free (name);
-                        return FALSE;
-                }
+        if (language_name == NULL) {
+                return FALSE;
         }
 
-        if (!language_name_is_valid (name)) {
-                g_free (name);
+        if (!language_name_is_valid (language_name)) {
                 return FALSE;
         }
 
-
         locale = g_new0 (GdmLocale, 1);
-        gdm_parse_language_name (name,
+        gdm_parse_language_name (language_name,
                                  &locale->language_code,
                                  &locale->territory_code,
                                  &locale->codeset,
                                  &locale->modifier);
-        g_free (name);
-        name = NULL;
 
         locale->id = construct_language_name (locale->language_code, locale->territory_code,
                                               NULL, locale->modifier);
         locale->name = construct_language_name (locale->language_code, locale->territory_code,
                                                 locale->codeset, locale->modifier);
 
-        if (!language_name_has_translations (locale->name) &&
-            !language_name_has_translations (locale->id) &&
-            !language_name_has_translations (locale->language_code)) {
-                gdm_locale_free (locale);
-                return FALSE;
-        }
-
         old_locale = g_hash_table_lookup (gdm_available_locales_map, locale->id);
         if (old_locale != NULL) {
                 if (strlen (old_locale->name) > strlen (locale->name)) {
@@ -378,6 +353,32 @@ add_locale (const char *language_name)
         return TRUE;
 }
 
+static gboolean
+add_utf8_locale (const char *language_name)
+{
+        char *name = NULL;
+        gboolean retval = FALSE;
+
+        if (language_name_is_utf8 (language_name)) {
+                name = g_strdup (language_name);
+        } else {
+#ifdef __sun
+                return FALSE;
+#else
+                name = g_strdup_printf ("%s.utf8", language_name);
+
+                if (!language_name_is_utf8 (name)) {
+                        g_free (name);
+                        return FALSE;
+                }
+#endif
+        }
+        retval = add_locale (name);
+        g_free (name);
+
+        return retval;
+}
+
 struct nameent
 {
         char    *name;
@@ -430,7 +431,7 @@ collect_locales_from_archive (void)
         }
 
         for (cnt = 0; cnt < used; ++cnt) {
-                add_locale (names[cnt].name);
+                add_utf8_locale (names[cnt].name);
         }
 
         g_free (names);
@@ -459,7 +460,7 @@ select_dirs (const struct dirent *dirent
                                 struct stat st;
                                 char       *path;
 
-                                path = g_build_filename (GNOMELOCALEDIR, dirent->d_name, NULL);
+                                path = g_build_filename (LIBLOCALEDIR, dirent->d_name, NULL);
                                 if (g_stat (path, &st) == 0) {
                                         mode = st.st_mode;
                                 }
@@ -479,10 +480,17 @@ collect_locales_from_directory (void)
         int             ndirents;
         int             cnt;
 
-        ndirents = scandir (GNOMELOCALEDIR, &dirents, select_dirs, alphasort);
+        ndirents = scandir (LIBLOCALEDIR, &dirents, select_dirs, alphasort);
 
         for (cnt = 0; cnt < ndirents; ++cnt) {
-                add_locale (dirents[cnt]->d_name);
+#ifdef __sun
+                /* No longer use the short locale names by default. */
+                char *is_territory = index (dirents[cnt]->d_name, '_');
+                if (is_territory  == NULL) {
+                        continue;
+                }
+#endif
+                add_utf8_locale (dirents[cnt]->d_name);
         }
 
         if (ndirents > 0) {
@@ -491,6 +499,59 @@ collect_locales_from_directory (void)
 }
 
 static void
+collect_locales_from_locale_file (const char *locale_file)
+{
+        FILE *langlist;
+        char curline[256];
+        char *getsret;
+
+        if (locale_file == NULL)
+                return;
+
+        langlist = fopen (locale_file, "r");
+
+        if (langlist == NULL)
+                return;
+
+        for (;;) {
+                char *name;
+                char *lang;
+                char **lang_list;
+                int i;
+
+                getsret = fgets (curline, sizeof (curline), langlist);
+                if (getsret == NULL)
+                        break;
+
+                if (curline[0] <= ' ' ||
+                    curline[0] == '#')
+                        continue;
+
+                name = strtok (curline, " \t\r\n");
+                if (name == NULL)
+                        continue;
+
+                lang = strtok (NULL, " \t\r\n");
+                if (lang == NULL)
+                        continue;
+
+                lang_list = g_strsplit (lang, ",", -1);
+                if (lang_list == NULL)
+                        continue;
+
+                lang = NULL;
+                for (i = 0; lang_list[i] != NULL; i++) {
+                        if (add_locale (lang_list[i])) {
+                                break;
+                        }
+                }
+                g_strfreev (lang_list);
+        }
+
+        fclose (langlist);
+}
+
+static void
 collect_locales (void)
 {
 
@@ -507,6 +568,7 @@ collect_locales (void)
 
                 collect_locales_from_directory ();
         }
+        collect_locales_from_locale_file (ALIASES_FILE);
 }
 
 static gboolean
