mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-25 15:33:57 +00:00
Attempt to fix locale detection on OSX. By Henrik Holst.
This commit is contained in:
parent
a420aa4f70
commit
1f3e472551
1 changed files with 31 additions and 1 deletions
|
@ -39,6 +39,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BBGE_BUILD_MACOSX
|
||||||
|
#include <CFLocale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void UserSettings::save()
|
void UserSettings::save()
|
||||||
{
|
{
|
||||||
//initInputCodeMap();
|
//initInputCodeMap();
|
||||||
|
@ -641,9 +645,35 @@ void UserSettings::getSystemLocale()
|
||||||
system.locale += ctry;
|
system.locale += ctry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif BBGE_BUILD_MACOSX
|
||||||
|
CFLocaleRef locale = CFLocaleCopyCurrent();
|
||||||
|
CFTypeRef type;
|
||||||
|
CFStringRef buf;
|
||||||
|
|
||||||
|
type = CFLocaleGetValue(locale, kCFLocaleLanguageCode);
|
||||||
|
|
||||||
|
if ((buf = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleLanguageCode, type)) != NULL)
|
||||||
|
{
|
||||||
|
system.locale = buf;
|
||||||
|
CFRelease(buf);
|
||||||
|
CFRelease(type);
|
||||||
|
|
||||||
|
type = CFLocaleGetValue(locale, kCFLocaleCountryCode);
|
||||||
|
|
||||||
|
if ((buf = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleCountryCode, type)) != NULL)
|
||||||
|
{
|
||||||
|
system.locale += "_";
|
||||||
|
system.locale += buf;
|
||||||
|
CFRelease(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(locale);
|
||||||
#else
|
#else
|
||||||
// FIXME: Apparently this is not set when starting the game via the UI on OSX.
|
|
||||||
const char *lang = (const char *)getenv("LANG");
|
const char *lang = (const char *)getenv("LANG");
|
||||||
|
|
||||||
if (lang && *lang)
|
if (lang && *lang)
|
||||||
{
|
{
|
||||||
system.locale = lang;
|
system.locale = lang;
|
||||||
|
|
Loading…
Add table
Reference in a new issue