Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2025-01-31 18:29:34 +08:00
38 changed files with 671 additions and 278 deletions

View File

@@ -30,13 +30,20 @@ char const* localeNames[TOTAL_LOCALES] =
"ruRU"
};
bool IsLocaleValid(std::string const& locale)
{
for (int i = 0; i < TOTAL_LOCALES; ++i)
if (locale == localeNames[i])
return true;
return false;
}
LocaleConstant GetLocaleByName(const std::string& name)
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
if (name == localeNames[i])
{
return LocaleConstant(i);
}
return LOCALE_enUS; // including enGB case
}

View File

@@ -83,6 +83,7 @@ enum LocaleConstant
AC_COMMON_API extern char const* localeNames[TOTAL_LOCALES];
AC_COMMON_API bool IsLocaleValid(std::string const& locale);
AC_COMMON_API LocaleConstant GetLocaleByName(const std::string& name);
AC_COMMON_API const std::string GetNameByLocaleConstant(LocaleConstant localeConstant);
AC_COMMON_API void CleanStringForMysqlQuery(std::string& str);