From b5fbd5149530e0d79d459af3b5cfcc925bea4d1a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 19 Sep 2002 23:19:24 +0000 Subject: [PATCH] On Win32, look explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, 2002-09-20 Tor Lillqvist * gtk/gtkmain.c (gtk_get_default_language): On Win32, look explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use g_win32_getlocale(). The setlocale() in msvcrt.dll would return a locale name in the form Swedish_Finland for sv_FI. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gtk/gtkmain.c | 30 ++++++++++++++++++++++++++++++ 7 files changed, 72 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2a074dd8d2..60c0a9267a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-09-20 Tor Lillqvist + + * gtk/gtkmain.c (gtk_get_default_language): On Win32, look + explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use + g_win32_getlocale(). The setlocale() in msvcrt.dll would return a + locale name in the form Swedish_Finland for sv_FI. + 2002-09-16 Tor Lillqvist * gdk/gdkfont.h: Delete leftover declarations of the obsolete diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2a074dd8d2..60c0a9267a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2002-09-20 Tor Lillqvist + + * gtk/gtkmain.c (gtk_get_default_language): On Win32, look + explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use + g_win32_getlocale(). The setlocale() in msvcrt.dll would return a + locale name in the form Swedish_Finland for sv_FI. + 2002-09-16 Tor Lillqvist * gdk/gdkfont.h: Delete leftover declarations of the obsolete diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2a074dd8d2..60c0a9267a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +2002-09-20 Tor Lillqvist + + * gtk/gtkmain.c (gtk_get_default_language): On Win32, look + explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use + g_win32_getlocale(). The setlocale() in msvcrt.dll would return a + locale name in the form Swedish_Finland for sv_FI. + 2002-09-16 Tor Lillqvist * gdk/gdkfont.h: Delete leftover declarations of the obsolete diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2a074dd8d2..60c0a9267a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +2002-09-20 Tor Lillqvist + + * gtk/gtkmain.c (gtk_get_default_language): On Win32, look + explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use + g_win32_getlocale(). The setlocale() in msvcrt.dll would return a + locale name in the form Swedish_Finland for sv_FI. + 2002-09-16 Tor Lillqvist * gdk/gdkfont.h: Delete leftover declarations of the obsolete diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2a074dd8d2..60c0a9267a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2002-09-20 Tor Lillqvist + + * gtk/gtkmain.c (gtk_get_default_language): On Win32, look + explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use + g_win32_getlocale(). The setlocale() in msvcrt.dll would return a + locale name in the form Swedish_Finland for sv_FI. + 2002-09-16 Tor Lillqvist * gdk/gdkfont.h: Delete leftover declarations of the obsolete diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2a074dd8d2..60c0a9267a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2002-09-20 Tor Lillqvist + + * gtk/gtkmain.c (gtk_get_default_language): On Win32, look + explicitly for LANG, LC_ALL and LC_CTYPE, and if not found, use + g_win32_getlocale(). The setlocale() in msvcrt.dll would return a + locale name in the form Swedish_Finland for sv_FI. + 2002-09-16 Tor Lillqvist * gdk/gdkfont.h: Delete leftover declarations of the obsolete diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 3ea36f7092..d24bfd2bf3 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -892,7 +892,37 @@ gtk_get_default_language (void) PangoLanguage *result; gchar *p; +#ifdef G_OS_WIN32 + /* Somebody might try to set the locale for this process using the + * LANG or LC_ environment variables. The Microsoft C library + * doesn't know anything about them. You set the locale in the + * Control Panel. Setting these env vars won't have any affect on + * locale-dependent C library functions like ctime. But just for + * kicks, do obey LC_ALL, LANG and LC_CTYPE in GTK. (This also makes + * it easier to test GTK and Pango in various default languages, you + * don't have to clickety-click in the Control Panel, you can simply + * start the program with LC_ALL=something on the command line.) + */ + p = getenv ("LC_ALL"); + if (p != NULL) + lang = g_strdup (p); + else + { + p = getenv ("LANG"); + if (p != NULL) + lang = g_strdup (p); + else + { + p = getenv ("LC_CTYPE"); + if (p != NULL) + lang = g_strdup (p); + else + lang = g_win32_getlocale (); + } + } +#else lang = g_strdup (setlocale (LC_CTYPE, NULL)); +#endif p = strchr (lang, '.'); if (p) *p = '\0';