aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Common.cpp4
-rw-r--r--src/common/Common.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/common/Common.cpp b/src/common/Common.cpp
index b768461e274..a176941e6f9 100644
--- a/src/common/Common.cpp
+++ b/src/common/Common.cpp
@@ -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;
}
diff --git a/src/common/Common.h b/src/common/Common.h
index 732583da0de..f35773e7c70 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -101,6 +101,11 @@ TC_COMMON_API extern char const* localeNames[TOTAL_LOCALES];
TC_COMMON_API LocaleConstant GetLocaleByName(std::string const& name);
+constexpr inline bool IsValidLocale(LocaleConstant locale)
+{
+ return locale < TOTAL_LOCALES&& locale != LOCALE_none;
+}
+
#pragma pack(push, 1)
struct LocalizedString