X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Flocale.cxx;h=fd7a5f2b5137aeb8a1f290a69db414f23bde2fb4;hb=0c00cd3c6d34e4e167457897a274864cb7236da6;hp=2544d0ba76077db2322610e69292f273fabb549d;hpb=ef55d175dd71130ee1cd91a40ba091683ab8e83a;p=flightgear.git diff --git a/src/Main/locale.cxx b/src/Main/locale.cxx index 2544d0ba7..fd7a5f2b5 100644 --- a/src/Main/locale.cxx +++ b/src/Main/locale.cxx @@ -26,7 +26,7 @@ #include #endif -#include // for va_start/_end +#include #include #include @@ -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; igetPath() ); break; } } - if (!locale) + // load resource for system messages (translations for fgfs internal messages) + loadResource("sys"); + + // load resource for atc messages + loadResource("atc"); + + if (!_currentLocale) { SG_LOG(SG_GENERAL, SG_ALERT, - "No internationalization settings specified in preferences.xml" ); + "System locale not found or no internationalization settings specified in preferences.xml. Using default (en)." ); return false; } - _currentLocale = locale; - - // load resource for system messages (translations for fgfs internal messages) - loadResource("sys"); - return true; } @@ -227,21 +210,21 @@ FGLocale::loadResource(SGPropertyNode* localeNode, const char* resource) if (!path_str) { SG_LOG(SG_GENERAL, SG_WARN, "No path in " << stringNode->getPath() << "/" << resource << "."); - return NULL; + return false; } path.append(path_str); SG_LOG(SG_GENERAL, SG_INFO, "Reading localized strings for '" << localeNode->getStringValue("lang", "") - <<"' from " << path.str()); + <<"' from " << path); // load the actual file try { - readProperties(path.str(), stringNode->getNode(resource, 0, true)); + readProperties(path, stringNode->getNode(resource, 0, true)); } catch (const sg_exception &e) { - SG_LOG(SG_GENERAL, SG_ALERT, "Unable to read the localized strings from " << path.str() << + SG_LOG(SG_GENERAL, SG_ALERT, "Unable to read the localized strings from " << path << ". Error: " << e.getFormattedMessage()); return false; }