[9168] Correctly work with alternative locale names.

Allow use enGB locale subdirectory for DBC files.
This commit is contained in:
VladimirMangos 2010-01-13 07:49:16 +03:00
parent 3d7d7fd512
commit e246b49e55
4 changed files with 37 additions and 9 deletions

View file

@ -19,7 +19,7 @@
#include "Common.h"
char const* localeNames[MAX_LOCALE] = {
"enUS",
"enUS", // also enGB
"koKR",
"frFR",
"deDE",
@ -30,11 +30,27 @@ char const* localeNames[MAX_LOCALE] = {
"ruRU"
};
// used for search by name or iterate all names
LocaleNameStr fullLocaleNameList[] =
{
{ "enUS", LOCALE_enUS },
{ "enGB", LOCALE_enUS },
{ "koKR", LOCALE_koKR },
{ "frFR", LOCALE_frFR },
{ "deDE", LOCALE_deDE },
{ "zhCN", LOCALE_zhCN },
{ "zhTW", LOCALE_zhTW },
{ "esES", LOCALE_esES },
{ "esMX", LOCALE_esMX },
{ "ruRU", LOCALE_ruRU },
{ NULL, LOCALE_enUS }
};
LocaleConstant GetLocaleByName(const std::string& name)
{
for(uint32 i = 0; i < MAX_LOCALE; ++i)
if(name==localeNames[i])
return LocaleConstant(i);
for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr)
if (name==itr->name)
return itr->locale;
return LOCALE_enUS; // including enGB case
}