--- gdm/configure.ac.orig	2009-10-29 22:13:02.846501111 +0900
+++ gdm/configure.ac	2009-10-30 01:29:51.814974387 +0900
@@ -271,7 +271,7 @@ AC_ARG_WITH(lang-file,
 if test x$withval != x; then
 	LANG_CONFIG_FILE="$withval"
 else
-	LANG_CONFIG_FILE='${sysconfdir}/sysconfig/i18n'
+	LANG_CONFIG_FILE='$(sysconfdir)/sysconfig/i18n'
 fi
 AC_SUBST(LANG_CONFIG_FILE)
 
--- gdm/daemon/gdm.in.orig	2009-10-07 01:23:25.631707451 +0900
+++ gdm/daemon/gdm.in	2009-10-29 21:53:49.733773574 +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/daemon/gdm-slave-proxy.c.orig	2009-10-28 13:53:42.000000000 +0900
+++ gdm/daemon/gdm-slave-proxy.c	2009-11-02 16:47:48.000000000 +0900
@@ -99,6 +99,95 @@ child_watch (GPid           pid,
 }
 
 static void
+load_lang_config_file (const gchar *config_file)
+{
+        gchar *contents = NULL;
+        gchar *p;
+        gchar *key;
+        gchar *value;
+        gsize length;
+        GError *error;
+        GString *line;
+        GRegex *re;
+
+        g_return_if_fail (config_file != NULL);
+
+        if (!g_file_test (config_file, G_FILE_TEST_EXISTS)) {
+                g_debug ("Cannot access '%s'", config_file);
+                return;
+        }
+
+        error = NULL;
+        if (!g_file_get_contents (config_file, &contents, &length, &error)) {
+                g_debug ("Failed to parse '%s': %s",
+                         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'", 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;
+                GMatchInfo *match_info = NULL;
+
+                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);
+}
+
+static void
 rotate_logs (const char *path,
              guint       n_copies)
 {
@@ -132,6 +221,7 @@ typedef struct {
 static void
 spawn_child_setup (SpawnChildData *data)
 {
+        load_lang_config_file (LANG_CONFIG_FILE);
 
         if (data->log_file != NULL) {
                 int logfd;
