--- gdm-2.28.0/daemon/gdm.in.orig	2009-10-07 09:40:14.000000000 +0900
+++ gdm-2.28.0/daemon/gdm.in	2009-10-28 11:18:29.000000000 +0900
@@ -6,10 +6,6 @@
 
 test -f /etc/profile && . /etc/profile
 
-# Try to set LC_MESSAGES to LANG if neither LC_MESSAGES or LC_ALL is set.
-# This ensures that gdm can display in a system's default language if only
-# LANG is set.
-
 # Make sure LANG is set
 #
 if [ -z "$LANG" ]
@@ -21,14 +17,5 @@ then
   fi
 fi
 
-if [ -z "$LC_MESSAGES" ]
-then
-  if [ -z "$LC_ALL" ]
-  then
-    LC_MESSAGES=$LANG
-    export LC_MESSAGES
-  fi
-fi
-
 exec @sbindir@/gdm-binary "$@"
 
--- gdm-2.28.0/daemon/gdm-slave-proxy.c.orig	2009-10-28 13:53:42.000000000 +0900
+++ gdm-2.28.0/daemon/gdm-slave-proxy.c	2009-10-28 18:35:13.000000000 +0900
@@ -99,6 +99,102 @@ child_watch (GPid           pid,
 }
 
 static void
+load_lang_config_file (void)
+{
+#ifdef LANG_CONFIG_FILE
+        const gchar *gdmlang = g_getenv ("GDM_LANG");
+        gchar *contents = NULL;
+        gchar *p;
+        gchar *key;
+        gchar *value;
+        gsize length;
+        GError *error;
+        GString *line;
+        GRegex *re;
+        GMatchInfo *match_info;
+        int category;
+
+        if (gdmlang) {
+                g_setenv ("LANG", gdmlang, TRUE);
+                g_unsetenv ("LC_ALL");
+                g_unsetenv ("LC_MESSAGES");
+                return;
+        }
+
+        g_return_if_fail (LANG_CONFIG_FILE != NULL);
+
+        if (!g_file_test (LANG_CONFIG_FILE, G_FILE_TEST_EXISTS)) {
+                g_warning ("Cannot access '%s'", LANG_CONFIG_FILE);
+                return;
+        }
+
+        error = NULL;
+        if (!g_file_get_contents (LANG_CONFIG_FILE, &contents, &length, &error)) {
+                g_warning ("Failed to parse '%s': %s",
+                           LANG_CONFIG_FILE,
+                           (error && error->message) ? error->message : "(null)");
+                g_error_free (error);
+                return;
+        }
+
+        if (!g_utf8_validate (contents, length, NULL)) {
+                g_warning ("Invalid UTF-8 in '%s'", LANG_CONFIG_FILE);
+                g_free (contents);
+                return;
+        }
+
+        error = NULL;
+        re = g_regex_new ("(?P<key>(LC_.*|LANG))=(\")?(?P<value>[^\"]*)?(\")?",
+                          0, 0, &error);
+        if (re == NULL) {
+                g_warning ("Failed to regex: %s",
+                           (error && error->message) ? error->message : "(null)");
+                g_error_free (error);
+                g_free (contents);
+                return;
+        }
+
+        line = g_string_new ("");
+        for (p = contents; p && *p; p = g_utf8_find_next_char (p, NULL)) {
+                gunichar ch;
+
+                ch = g_utf8_get_char (p);
+                if ((ch != '\n') && (ch != '\0')) {
+                        g_string_append_unichar (line, ch);
+                        continue;
+                }
+
+                if (line->str && g_utf8_get_char (line->str) == '#')
+                        goto next_line;
+
+                if (!g_regex_match (re, line->str, 0, &match_info))
+                        goto next_line;
+
+                if (!g_match_info_matches (match_info))
+                        goto next_line;
+
+                key = g_match_info_fetch_named (match_info, "key");
+                value = g_match_info_fetch_named (match_info, "value");
+
+                if (key && *key && value && *value)
+                        g_setenv (key, value, TRUE);
+                else if (key && *key)
+                        g_unsetenv (key);
+
+                g_free (key);
+                g_free (value);
+next_line:
+                g_match_info_free (match_info);
+                g_string_set_size (line, 0);
+        }
+
+        g_string_free (line, TRUE);
+        g_regex_unref (re);
+        g_free (contents);
+#endif
+}
+
+static void
 rotate_logs (const char *path,
              guint       n_copies)
 {
@@ -133,6 +229,8 @@ static void
 spawn_child_setup (SpawnChildData *data)
 {
 
+        load_lang_config_file ();
+
         if (data->log_file != NULL) {
                 int logfd;
 
