Fixed: With new iOS versions (and perhaps OS X), locale can contains country code

--HG--
branch : develop
This commit is contained in:
kervala 2016-03-09 11:24:01 +01:00
parent 41176a7d02
commit faae2973ac

View file

@ -306,11 +306,20 @@ std::string CI18N::getSystemLanguageCode ()
CFRelease(langCF);
}
// only keep language code if supported by NeL
if (!lang.empty() && isLanguageCodeSupported(lang))
if (!lang.empty())
{
s_cachedSystemLanguage = lang;
break;
// fix language code if country is specified
std::string::size_type pos = lang.find('-');
if (pos != std::string::npos)
lang = lang.substr(0, pos);
// only keep language code if supported by NeL
if (isLanguageCodeSupported(lang))
{
s_cachedSystemLanguage = lang;
break;
}
}
}