Fixed g_win32_getlocale
authorAxlPr <alexprentl@gmail.com>
Tue, 12 Nov 2013 09:31:11 +0000 (09:31 +0000)
committerAxlPr <alexprentl@gmail.com>
Tue, 12 Nov 2013 09:31:11 +0000 (09:31 +0000)
Implemented g_win32_getlocale function to return correct locale.

eglib/src/gmisc-win32.c

index 07dcf39aec86c58ffbbe9cccb19b5291d30cc576..f89f37c22049a780451ff55dcb4d3369ce8d1d10 100644 (file)
@@ -87,10 +87,12 @@ g_unsetenv(const gchar *variable)
 gchar*
 g_win32_getlocale(void)
 {
-       /* FIXME: Use GetThreadLocale
-        * and convert LCID to standard 
-        * string form, "en_US" */
-       return strdup ("en_US");
+       LCID lcid = GetThreadLocale();
+       gchar buf[19];
+       gint ccBuf = GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, buf, 9);
+       buf[ccBuf - 1] = '-';
+       ccBuf += GetLocaleInfo(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+       return strdup(buf);
 }
 
 gboolean