mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user