From 14e9427a9e53837d29bcdd1ba957e6e57ea0ac34 Mon Sep 17 00:00:00 2001
From: Tor Lillqvist <tml@novell.com>
Date: Wed, 10 Aug 2005 10:58:05 +0000
Subject: Use g_win32_getlocale() to get locale on Win32. (setlocale() returns

2005-08-10  Tor Lillqvist  <tml@novell.com>

	* e-xml-utils.c (e_xml_get_child_by_name_by_lang): Use
	g_win32_getlocale() to get locale on Win32. (setlocale() returns
	strings like "Swedish_Finland.1252", we want the Unixish "sv_FI"
	style.) Fix typo, use the lang parameter and not "lang" string
	literal.

svn path=/trunk/; revision=30077
---
 e-util/e-xml-utils.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'e-util/e-xml-utils.c')

diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
index 52c7d6fe77..4f919fcacd 100644
--- a/e-util/e-xml-utils.c
+++ b/e-util/e-xml-utils.c
@@ -73,6 +73,9 @@ e_xml_get_child_by_name_by_lang (const xmlNode *parent,
 				 const xmlChar *child_name,
 				 const gchar *lang)
 {
+#ifdef G_OS_WIN32
+	gchar *freeme = NULL;
+#endif
 	xmlNode *child;
 	/* This is the default version of the string. */
 	xmlNode *C = NULL;
@@ -81,10 +84,14 @@ e_xml_get_child_by_name_by_lang (const xmlNode *parent,
 	g_return_val_if_fail (child_name != NULL, NULL);
 
 	if (lang == NULL) {
+#ifndef G_OS_WIN32
 #ifdef HAVE_LC_MESSAGES
 		lang = setlocale (LC_MESSAGES, NULL);
 #else
 		lang = setlocale (LC_CTYPE, NULL);
+#endif
+#else
+		lang = freeme = g_win32_getlocale ();
 #endif
 	}
 	for (child = parent->xmlChildrenNode; child != NULL; child = child->next) {
@@ -92,11 +99,17 @@ e_xml_get_child_by_name_by_lang (const xmlNode *parent,
 			xmlChar *this_lang = xmlGetProp (child, "lang");
 			if (this_lang == NULL) {
 				C = child;
-			} else if (xmlStrcmp(this_lang, "lang") == 0) {
+			} else if (xmlStrcmp(this_lang, lang) == 0) {
+#ifdef G_OS_WIN32
+				g_free (freeme);
+#endif
 				return child;
 			}
 		}
 	}
+#ifdef G_OS_WIN32
+	g_free (freeme);
+#endif
 	return C;
 }
 
-- 
cgit