[PATCH] ntdll: Fix locale detection on Mac.

Brendan Shanks bshanks at codeweavers.com
Wed Jul 14 13:47:37 CDT 2021


Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---

Currently on Mac, WINELOCALE is set to a string like 'de_DE', but locale_to_lcid()
in kernelbase expects a Windows locale like 'de-DE', and a fallback English locale is used.

Alternately, unix_to_win_locale() could be used to convert the generated locale_string,
but it seems sufficient to just generate the string with a hyphen.

 dlls/ntdll/unix/env.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index b405624d7fb..e90bfbf171e 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -1085,7 +1085,7 @@ static void init_locale(void)
         CFStringRef locale_string;
 
         if (country)
-            locale_string = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@_%@"), lang, country);
+            locale_string = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@-%@"), lang, country);
         else
             locale_string = CFStringCreateCopy(NULL, lang);
 
@@ -1114,7 +1114,7 @@ static void init_locale(void)
                     country = CFLocaleGetValue( locale, kCFLocaleCountryCode );
                 }
                 if (country)
-                    locale_string = CFStringCreateWithFormat( NULL, NULL, CFSTR("%@_%@"), lang, country );
+                    locale_string = CFStringCreateWithFormat( NULL, NULL, CFSTR("%@-%@"), lang, country );
                 else
                     locale_string = CFStringCreateCopy( NULL, lang );
                 CFStringGetCString( locale_string, user_locale, sizeof(user_locale), kCFStringEncodingUTF8 );
-- 
2.31.1




More information about the wine-devel mailing list