diff --git a/src/GUI/CocoaHelpers.mm b/src/GUI/CocoaHelpers.mm index 8df796615..cc564a2b0 100644 --- a/src/GUI/CocoaHelpers.mm +++ b/src/GUI/CocoaHelpers.mm @@ -33,6 +33,7 @@ // flightgear #include #include
+#include
NSString* stdStringToCocoa(const std::string& s) { @@ -138,3 +139,15 @@ std::string Options::platformDefaultRoot() const } } // of namespace flightgear + +string_list FGLocale::getUserLanguage() +{ + CocoaAutoreleasePool ap; + string_list result; + + for (NSString* lang in [NSLocale preferredLanguages]) { + result.push_back(stdStringFromCocoa(lang)); + } + + return result; +} diff --git a/src/Main/locale.cxx b/src/Main/locale.cxx index a2fa6e42d..783b3f247 100644 --- a/src/Main/locale.cxx +++ b/src/Main/locale.cxx @@ -90,27 +90,7 @@ FGLocale::getUserLanguage() return result; } #elif __APPLE__ - -// determine locale / langauge on Mac -#include - -string_list -FGLocale::getUserLanguage() -{ - string_list result; - CFArrayRef langs = CFLocaleCopyPreferredLanguages(); - - char buffer[64]; - for (int i=0; i