--- gdm2/daemon/gdm.c.orig	2007-05-22 22:37:16.979995000 +0900
+++ gdm2/daemon/gdm.c	2007-05-22 22:39:43.051448000 +0900
@@ -135,6 +135,7 @@ int slave_fifo_pipe_fd = -1;    /* The s
 
 unsigned char *gdm_global_cookie  = NULL;
 unsigned char *gdm_global_bcookie = NULL;
+char *gdm_system_locale = NULL;
 
 gboolean gdm_first_login = TRUE;
 
@@ -1588,6 +1589,9 @@ main (int argc, char *argv[])
 
 	main_loop = g_main_loop_new (NULL, FALSE);
 
+	if (setlocale (LC_CTYPE, NULL) != NULL) {
+		gdm_system_locale = g_strdup (setlocale (LC_CTYPE, NULL));
+	}
 	/* initial TERM/INT handler */
 	sig.sa_handler = initial_term_int;
 	sig.sa_flags = SA_RESTART;
--- gdm2/daemon/slave.c.orig	2007-05-21 16:54:44.428879000 +0900
+++ gdm2/daemon/slave.c	2007-05-22 22:47:54.454084000 +0900
@@ -162,6 +162,8 @@ extern int slave_fifo_pipe_fd;
 /* wait for a GO in the SOP protocol */
 extern gboolean gdm_wait_for_go;
 
+extern char *gdm_system_locale;
+
 typedef struct {
 	pid_t pid;
 } GdmWaitPid;
@@ -4357,13 +4359,11 @@ gdm_slave_session_start (void)
 
 	case 0:
 		{
-			const char *gdm_system_locale;
 			const char *lang;
 			gboolean    has_language;
 
 			has_language = (language != NULL) && (language[0] != '\0');
 
-			gdm_system_locale = setlocale (LC_CTYPE, NULL);
 			if ((gdm_system_locale != NULL) && (!has_language)) {
 				lang = gdm_system_locale;
 			} else {
@@ -4395,10 +4395,6 @@ gdm_slave_session_start (void)
 	default:
 		always_restart_greeter = FALSE;
 		if (!savelang && language && strcmp (usrlang, language)) {
-			const char *gdm_system_locale;
-
-			gdm_system_locale = setlocale (LC_CTYPE, NULL);
-
 			if (gdm_system_locale != NULL) {
 				g_setenv ("LANG", gdm_system_locale, TRUE);
 				setlocale (LC_ALL, "");
