Core/Misc: Changed GetLocaleByName to return invalid value on invalid input instead of LOCALE_enUS

* Also added IsValidLocale helper function
This commit is contained in:
Shauren
2020-06-30 00:22:25 +02:00
parent 40c71ea9fc
commit 79cd94d26d
6 changed files with 23 additions and 18 deletions

View File

@@ -33,11 +33,11 @@ char const* localeNames[TOTAL_LOCALES] =
"itIT"
};
LocaleConstant GetLocaleByName(const std::string& name)
LocaleConstant GetLocaleByName(std::string const& name)
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
if (name == localeNames[i])
return LocaleConstant(i);
return LOCALE_enUS; // including enGB case
return TOTAL_LOCALES;
}