From 21841e84a85477c0712f3540def89261e1e91808 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 18 Aug 2012 03:13:24 +0000 Subject: [PATCH] Get the locale name for OS X from CF rather than wx Originally committed to SVN as r6954. --- aegisub/src/dialog_version_check.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/aegisub/src/dialog_version_check.cpp b/aegisub/src/dialog_version_check.cpp index 18af23dcf..3fbea7fc6 100644 --- a/aegisub/src/dialog_version_check.cpp +++ b/aegisub/src/dialog_version_check.cpp @@ -81,6 +81,10 @@ #include +#ifdef __APPLE__ +#include +#endif + /* *** Public API is implemented here *** */ // Allocate global lock mutex declared in header @@ -305,6 +309,19 @@ static wxString GetSystemLanguage() return res; } +#elif __APPLE__ +static wxString GetSystemLanguage() +{ + CFLocaleRef locale = CFLocaleCopyCurrent(); + CFStringRef localeName = (CFStringRef)CFLocaleGetValue(locale, kCFLocaleIdentifier); + + char buf[128]; + CFStringGetCString(localeName, buf, sizeof buf, kCFStringEncodingUTF8); + CFRelease(locale); + + return wxString::FromUTF8(buf); + +} #else static wxString GetSystemLanguage() {