Use Core Foundation for testing locale availability under Mac

Using setlocale() is not the right way to do it there, try checking if
the locale is supported by Core Foundation instead of whether it's
supported by the Unix layer which is neglected and not used under Mac.
This commit is contained in:
Vadim Zeitlin
2021-08-14 19:06:14 +02:00
parent 8f20dd3490
commit 59a4505a5f

View File

@@ -1131,6 +1131,13 @@ bool wxLocale::IsAvailable(int lang)
if ( !::IsValidLocale(info->GetLCID(), LCID_INSTALLED) )
return false;
#elif defined(__WXOSX__)
CFLocaleRef
cfloc = CFLocaleCreate(kCFAllocatorDefault, wxCFStringRef(info->CanonicalName));
if ( !cfloc )
return false;
CFRelease(cfloc);
#elif defined(__UNIX__)
// Test if setting the locale works, then set it back.