Robert Shearman : kernel32:
Add support for detecting the user locale preference from the system on
Mac OS X .
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Oct 16 13:58:56 CDT 2006
Module: wine
Branch: master
Commit: ed263ae48ebecf280314f3d5163829a2fbbb386a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ed263ae48ebecf280314f3d5163829a2fbbb386a
Author: Robert Shearman <rob at codeweavers.com>
Date: Mon Oct 16 16:46:46 2006 +0100
kernel32: Add support for detecting the user locale preference from the system on Mac OS X.
---
dlls/kernel32/locale.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 9864427..0d68edc 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -31,6 +31,11 @@ #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
+#ifdef __APPLE__
+# include <CoreFoundation/CFLocale.h>
+# include <CoreFoundation/CFString.h>
+#endif
+
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
@@ -505,10 +510,20 @@ static LCID get_env_lcid( UINT *unix_cp,
{
char *buf, *lang,*country,*charset,*dialect,*next;
LCID ret = 0;
+ char user_locale[50] = { 0 };
+#ifdef __APPLE__
+ CFLocaleRef user_locale_ref = CFLocaleCopyCurrent();
+ CFStringRef user_locale_string_ref = CFLocaleGetIdentifier(user_locale_ref);
+
+ CFStringGetCString(user_locale_string_ref, user_locale,
+ sizeof(user_locale), kCFStringEncodingUTF8);
+ CFRelease(user_locale_ref);
+#endif
if (((lang = getenv( "LC_ALL" )) && *lang) ||
(env_str && (lang = getenv( env_str )) && *lang) ||
- ((lang = getenv( "LANG" )) && *lang))
+ ((lang = getenv( "LANG" )) && *lang) ||
+ ((lang = user_locale) && *lang))
{
if (!strcmp(lang,"POSIX") || !strcmp(lang,"C")) goto done;
@@ -545,6 +560,10 @@ static LCID get_env_lcid( UINT *unix_cp,
else
FIXME("charset %s was not recognized\n", charset);
}
+#ifdef __APPLE__
+ /* charset on Mac OS X is always UTF8 */
+ else if (unix_cp) *unix_cp = CP_UTF8;
+#endif
lang=next;
} while (lang && !ret);
More information about the wine-cvs
mailing list