[9168] Correctly work with alternative locale names.
[getmangos.git] / src / shared / Common.cpp
blob92270676f84f19672037695812986882c70669e9
1 /*
2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "Common.h"
21 char const* localeNames[MAX_LOCALE] = {
22 "enUS", // also enGB
23 "koKR",
24 "frFR",
25 "deDE",
26 "zhCN",
27 "zhTW",
28 "esES",
29 "esMX",
30 "ruRU"
33 // used for search by name or iterate all names
34 LocaleNameStr fullLocaleNameList[] =
36 { "enUS", LOCALE_enUS },
37 { "enGB", LOCALE_enUS },
38 { "koKR", LOCALE_koKR },
39 { "frFR", LOCALE_frFR },
40 { "deDE", LOCALE_deDE },
41 { "zhCN", LOCALE_zhCN },
42 { "zhTW", LOCALE_zhTW },
43 { "esES", LOCALE_esES },
44 { "esMX", LOCALE_esMX },
45 { "ruRU", LOCALE_ruRU },
46 { NULL, LOCALE_enUS }
49 LocaleConstant GetLocaleByName(const std::string& name)
51 for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr)
52 if (name==itr->name)
53 return itr->locale;
55 return LOCALE_enUS; // including enGB case