All pastes #753436 Raw Edit

Mine

public text v1 · immutable
#753436 ·published 2007-10-29 07:54 UTC
rendered paste body
Index: src/game/Creature.h
===================================================================
--- src/game/Creature.h	(revision 4648)
+++ src/game/Creature.h	(working copy)
@@ -207,9 +207,8 @@
 
 struct CreatureLocale
 {
-    uint32 Entry;
-    std::string Name[8];
-    std::string SubName[8];
+    std::vector<std::string> Name;
+    std::vector<std::string> SubName;
 };
 
 struct EquipmentInfo
Index: src/game/GossipDef.cpp
===================================================================
--- src/game/GossipDef.cpp	(revision 4651)
+++ src/game/GossipDef.cpp	(working copy)
@@ -148,8 +148,8 @@
         data << uint32( pQuest ? pQuest->GetQuestLevel() : 0 );
         std::string Title = pQuest->GetTitle();
 
-        uint8 m_language = pSession->GetSessionLanguage();
-        if (m_language > 0)
+        LocaleConstant m_language = pSession->GetSessionLanguage();
+        if (m_language > LOCALE_ENG)
         {
             QuestLocale const *ql = objmgr.GetQuestLocale(questID);
             if (ql)
@@ -210,8 +210,8 @@
             Text_0[i]=pGossip->Options[i].Text_0;
             Text_1[i]=pGossip->Options[i].Text_1;
         }
-        uint8 m_language = pSession->GetSessionLanguage();
-        if (m_language > 0)
+        LocaleConstant m_language = pSession->GetSessionLanguage();
+        if (m_language > LOCALE_ENG)
         {
             NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID);
             if (nl)
@@ -359,8 +359,8 @@
     Objectives = pQuest->GetObjectives();
     EndText = pQuest->GetEndText();
 
-    uint8 m_language = pSession->GetSessionLanguage();
-    if (m_language > 0)
+    LocaleConstant m_language = pSession->GetSessionLanguage();
+    if (m_language > LOCALE_ENG)
     {
         QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId());
         if (ql)
@@ -454,8 +454,8 @@
     for (int i=0;i<QUEST_OBJECTIVES_COUNT;i++)
         ObjectiveText[i]=pQuest->ObjectiveText[i];
 
-    uint8 m_language = pSession->GetSessionLanguage();
-    if ( m_language > 0)
+    LocaleConstant m_language = pSession->GetSessionLanguage();
+    if ( m_language > LOCALE_ENG)
     {
         QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId());
         if (ql)
@@ -567,8 +567,8 @@
     Title = pQuest->GetTitle();
     OfferRewardText = pQuest->GetOfferRewardText();
 
-    uint8 m_language = pSession->GetSessionLanguage();
-    if (m_language>0)
+    LocaleConstant m_language = pSession->GetSessionLanguage();
+    if (m_language>LOCALE_ENG)
     {
         QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId());
         if (ql)
@@ -680,8 +680,8 @@
     Title = pQuest->GetTitle();
     RequestItemsText = pQuest->GetRequestItemsText();
 
-    uint8 m_language = pSession->GetSessionLanguage();
-    if ( m_language > 0 )
+    LocaleConstant m_language = pSession->GetSessionLanguage();
+    if ( m_language > LOCALE_ENG )
     {
         QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId());
         if (ql)
Index: src/game/ItemHandler.cpp
===================================================================
--- src/game/ItemHandler.cpp	(revision 4648)
+++ src/game/ItemHandler.cpp	(working copy)
@@ -202,8 +202,8 @@
         Name = pProto->Name1;
         Description = pProto->Description;
 
-        uint8 m_language = GetSessionLanguage();
-        if ( m_language > 0 )
+        LocaleConstant m_language = GetSessionLanguage();
+        if ( m_language > LOCALE_ENG )
         {
             ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId);
             if (il)
@@ -812,8 +812,8 @@
         std::string Name;
         Name = pProto->Name1;
 
-        uint8 m_language = GetSessionLanguage();
-        if (m_language > 0)
+        LocaleConstant m_language = GetSessionLanguage();
+        if (m_language > LOCALE_ENG)
         {
             ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId);
             if (il)
Index: src/game/NPCHandler.h
===================================================================
--- src/game/NPCHandler.h	(revision 4648)
+++ src/game/NPCHandler.h	(working copy)
@@ -34,12 +34,6 @@
     uint32 Next_Page;
 };
 
-struct PageTextLocale
-{
-    uint32 Entry;
-    std::string Text[8];
-};
-
 // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform
 #if defined( __GNUC__ )
 #pragma pack()
@@ -68,11 +62,15 @@
     GossipTextOption Options[8];
 };
 
+struct PageTextLocale
+{
+    std::vector<std::string> Text;
+};
+
 struct NpcTextLocale
 {
-    uint32 Entry;
-    std::string Text_0[8][8];
-    std::string Text_1[8][8];
+    std::vector<std::string> Text_0[8];
+    std::vector<std::string> Text_1[8];
 };
 
 #endif
Index: src/game/ObjectMgr.cpp
===================================================================
--- src/game/ObjectMgr.cpp	(revision 4648)
+++ src/game/ObjectMgr.cpp	(working copy)
@@ -430,20 +430,8 @@
 
 void ObjectMgr::LoadCreatureLocales()
 {
-    const World::LocalizationMap *Locales = sWorld.GetSupportedLocals();
+    QueryResult *result = sDatabase.Query("SELECT `entry`,`name_loc1`,`subname_loc1`,`name_loc2`,`subname_loc2`,`name_loc3`,`subname_loc3`,`name_loc4`,`subname_loc4`,`name_loc5`,`subname_loc5`,`name_loc6`,`subname_loc6`,`name_loc7`,`subname_loc7` FROM `locales_creature`");
 
-    World::LocalizationMap::const_iterator itr = Locales->begin();
-    std::ostringstream ostr;
-    ostr << "`name_loc" << (int)*itr << "`,`subname_loc" << (int)*itr << "`";
-    itr++;
-    while (itr != Locales->end())
-    { 
-        ostr << ",`name_loc" << (int)*itr << "`,`subname_loc" << (int)*itr << "`";
-        itr++;
-    }
-
-    QueryResult *result = sDatabase.PQuery("SELECT `entry`,%s FROM `locales_creature`",ostr.str().c_str());
-
     if(!result)
     {
         barGoLink bar(1);
@@ -465,14 +453,34 @@
         uint32 entry = fields[0].GetUInt32();
 
         CreatureLocale& data = mCreatureLocaleMap[entry];
-        uint16 currentIndex=0;
-        for (itr = Locales->begin(); itr != Locales->end(); ++itr)
+
+        for(int i = 1; i < 8; ++i)
         {
-            data.Name[*itr]   = fields[currentIndex*2+1].GetCppString();
-            data.SubName[*itr]= fields[currentIndex*2+2].GetCppString();
-            currentIndex++;
+            std::string str = fields[1+2*i].GetCppString();
+            if(!str.empty())
+            {
+                int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+                if(idx <0)
+                    continue;
+
+                if(data.Name.size() <= idx)
+                    data.Name.resize(idx+1);
+
+                data.Name[idx] = str;
+            }
+            str = fields[1+2*i+1].GetCppString();
+            if(!str.empty())
+            {
+                int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+                if(idx <0)
+                    continue;
+
+                if(data.SubName.size() <= idx)
+                    data.SubName.resize(idx+1);
+
+                data.SubName[idx] = str;
+            }
         }
-
     } while (result->NextRow());
 
     delete result;
@@ -3144,20 +3152,8 @@
 
 void ObjectMgr::LoadPageTextLocales()
 {
-    const World::LocalizationMap *Locales = sWorld.GetSupportedLocals();
+    QueryResult *result = sDatabase.PQuery("SELECT `entry`,`text_loc1`,`text_loc2`,`text_loc3`,`text_loc4`,`text_loc5`,`text_loc6`,`text_loc7` FROM `locales_page_text`");
 
-    World::LocalizationMap::const_iterator itr = Locales->begin();
-    std::ostringstream ostr;
-    ostr << "`text_loc" << (int)*itr << "`";
-    itr++;
-    while (itr != Locales->end())
-    { 
-        ostr << ",`text_loc" << (int)*itr << "`";
-        itr++;
-    }
-
-    QueryResult *result = sDatabase.PQuery("SELECT `entry`,%s FROM `locales_page_text`",ostr.str().c_str());
-
     if(!result)
     {
         barGoLink bar(1);
@@ -3179,11 +3175,21 @@
         uint32 entry = fields[0].GetUInt32();
 
         PageTextLocale& data = mPageTextLocaleMap[entry];
-        uint16 currentIndex=0;
-        for (itr = Locales->begin(); itr != Locales->end(); ++itr)
+
+        for(int i = 1; i < 8; ++i)
         {
-            data.Text[*itr]   = fields[currentIndex+1].GetCppString();
-            currentIndex++;
+            std::string str = fields[i].GetCppString();
+            if(str.empty())
+                continue;
+
+            int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+            if(idx <0)
+                continue;
+
+            if(data.Text.size() <= idx)
+                data.Text.resize(idx+1);
+
+            data.Text[idx] = str;
         }
 
     } while (result->NextRow());
@@ -3274,23 +3280,25 @@
 
 void ObjectMgr::LoadNpcTextLocales()
 {
-    const World::LocalizationMap *Locales = sWorld.GetSupportedLocals();
+    QueryResult *result = sDatabase.Query("SELECT `entry`,"
+        "`Text0_0_loc1`,`Text0_0_loc2`,`Text0_0_loc3`,`Text0_0_loc4`,`Text0_0_loc5`,`Text0_0_loc6`,`Text0_0_loc7`,"
+        "`Text0_1_loc1`,`Text0_1_loc2`,`Text0_1_loc3`,`Text0_1_loc4`,`Text0_1_loc5`,`Text0_1_loc6`,`Text0_1_loc7`,"
+        "`Text1_0_loc1`,`Text1_0_loc2`,`Text1_0_loc3`,`Text1_0_loc4`,`Text1_0_loc5`,`Text1_0_loc6`,`Text1_0_loc7`,"
+        "`Text1_1_loc1`,`Text1_1_loc2`,`Text1_1_loc3`,`Text1_1_loc4`,`Text1_1_loc5`,`Text1_1_loc6`,`Text1_1_loc7`,"
+        "`Text2_0_loc1`,`Text2_0_loc2`,`Text2_0_loc3`,`Text2_0_loc4`,`Text2_0_loc5`,`Text2_0_loc6`,`Text2_0_loc7`,"
+        "`Text2_1_loc1`,`Text2_1_loc2`,`Text2_1_loc3`,`Text2_1_loc4`,`Text2_1_loc5`,`Text2_1_loc6`,`Text2_1_loc7`,"
+        "`Text3_0_loc1`,`Text3_0_loc2`,`Text3_0_loc3`,`Text3_0_loc4`,`Text3_0_loc5`,`Text3_0_loc6`,`Text3_0_loc7`,"
+        "`Text3_1_loc1`,`Text3_1_loc2`,`Text3_1_loc3`,`Text3_1_loc4`,`Text3_1_loc5`,`Text3_1_loc6`,`Text3_1_loc7`,"
+        "`Text4_0_loc1`,`Text4_0_loc2`,`Text4_0_loc3`,`Text4_0_loc4`,`Text4_0_loc5`,`Text4_0_loc6`,`Text4_0_loc7`,"
+        "`Text4_1_loc1`,`Text4_1_loc2`,`Text4_1_loc3`,`Text4_1_loc4`,`Text4_1_loc5`,`Text4_1_loc6`,`Text4_1_loc7`,"
+        "`Text5_0_loc1`,`Text5_0_loc2`,`Text5_0_loc3`,`Text5_0_loc4`,`Text5_0_loc5`,`Text5_0_loc6`,`Text5_0_loc7`,"
+        "`Text5_1_loc1`,`Text5_1_loc2`,`Text5_1_loc3`,`Text5_1_loc4`,`Text5_1_loc5`,`Text5_1_loc6`,`Text5_1_loc7`,"
+        "`Text6_0_loc1`,`Text6_0_loc2`,`Text6_0_loc3`,`Text6_0_loc4`,`Text6_0_loc5`,`Text6_0_loc6`,`Text6_0_loc7`,"
+        "`Text6_1_loc1`,`Text6_1_loc2`,`Text6_1_loc3`,`Text6_1_loc4`,`Text6_1_loc5`,`Text6_1_loc6`,`Text6_1_loc7`,"
+        "`Text7_0_loc1`,`Text7_0_loc2`,`Text7_0_loc3`,`Text7_0_loc4`,`Text7_0_loc5`,`Text7_0_loc6`,`Text7_0_loc7`,"
+        "`Text7_1_loc1`,`Text7_1_loc2`,`Text7_1_loc3`,`Text7_1_loc4`,`Text7_1_loc5`,`Text7_1_loc6`,`Text7_1_loc7`,"
+        " FROM `locales_npc_text`");
 
-    World::LocalizationMap::const_iterator itr = Locales->begin();
-    std::ostringstream ostr;
-    ostr << "`Text0_0_loc" << (int)*itr << "`,`Text0_1_loc" << (int)*itr << "`";
-    for (int i=1;i<8;i++)
-        ostr << ",`Text" << i << "_0_loc" << (int)*itr << "`,`Text" << i << "_1_loc" << (int)*itr << "`";
-    itr++;
-    while (itr != Locales->end())
-    {
-        for (int i=0;i<8;i++)
-            ostr << ",`Text" << i << "_0_loc" << (int)*itr << "`,`Text" << i << "_1_loc" << (int)*itr << "`";
-        itr++;
-    }
-
-    QueryResult *result = sDatabase.PQuery("SELECT `entry`,%s FROM `locales_npc_text`",ostr.str().c_str());
-
     if(!result)
     {
         barGoLink bar(1);
@@ -3312,6 +3320,36 @@
         uint32 entry = fields[0].GetUInt32();
 
         NpcTextLocale& data = mNpcTextLocaleMap[entry];
+        for(int j=0; j<8; ++j)
+        {
+            for(int i=1; i<8; ++i)
+            {
+                std::string str0 = fields[1+j*8+(i-1)].GetCppString();
+                if(!str0.empty())
+                {
+                    int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+                    if(idx <0)
+                        continue;
+
+                    if(data.Text_0[j].size() <= idx)
+                        data.Text_0[j].resize(idx+1);
+
+                    data.Text_0[j][idx] = str0;
+                }
+                std::string str1 = fields[1+j*8+2*(i-1)+1].GetCppString();
+                if(!str.empty())
+                {
+                    int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+                    if(idx <0)
+                        continue;
+
+                    if(data.Text_1[j].size() <= idx)
+                        data.Text_1[j].resize(idx+1);
+
+                    data.Text_1[j][idx] = str;
+                }
+            }
+        }
         uint16 currentIndex=0;
         for (itr = Locales->begin(); itr != Locales->end(); ++itr)
         {
@@ -5457,3 +5495,28 @@
     sLog.outString();
     sLog.outString( ">> Loaded %u reserved player names", count );
 }
+
+int ObjectMgr::GetIndexForLocale( LocaleConstant loc )
+{
+    if(loc==LOCALE_ENG)
+        return -1;
+
+    for(size_t i=0;i < m_LocalToIndex.size(); ++i)
+        if(m_LocalToIndex[i]==loc)
+            return i;
+
+    return -1;
+}
+
+int ObjectMgr::GetOrNewIndexForLocale( LocaleConstant loc )
+{
+    if(loc==LOCALE_ENG)
+        return -1;
+
+    for(size_t i=0;i < m_LocalToIndex.size(); ++i)
+        if(m_LocalToIndex[i]==loc)
+            return i;
+
+    m_LocalToIndex.push_back(loc);
+    return m_LocalToIndex.size()-1;
+}
\ No newline at end of file
Index: src/game/ObjectMgr.h
===================================================================
--- src/game/ObjectMgr.h	(revision 4648)
+++ src/game/ObjectMgr.h	(working copy)
@@ -724,6 +724,8 @@
         {
             return m_ReservedNames.find(name) != m_ReservedNames.end();
         }
+
+        int GetIndexForLocale(LocaleConstant loc);
     protected:
         uint32 m_auctionid;
         uint32 m_mailid;
@@ -776,6 +778,10 @@
         ReservedNamesMap    m_ReservedNames;
 
         GraveYardMap        mGraveYardMap;
+
+        typedef             std::vector<int> LocalToIndex;
+        LocalToIndex        m_LocalToIndex;
+        int GetOrNewIndexForLocale(LocaleConstant loc);
     private:
         void LoadScripts(ScriptMapMap& scripts, char const* tablename);
 
Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp	(revision 4649)
+++ src/game/Player.cpp	(working copy)
@@ -10533,20 +10533,37 @@
             else
             {
                 qe = gossiptext->Options[0].Emotes[0];
-                title = gossiptext->Options[0].Text_0 == "" ? gossiptext->Options[0].Text_1 : gossiptext->Options[0].Text_0;
-                if( &title == NULL )
-                    title = "";
 
-                uint8 m_language = GetSession()->GetSessionLanguage();
-                if (m_language > 0)
+                if(!gossiptext->Options[0].Text_0.empty())
                 {
-                    NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textid);
-                    if (nl)
+                    title = gossiptext->Options[0].Text_0;
+
+                    int loc_idx = GetSession()->GetSessionLanguageIndex();
+                    if (loc_idx >= 0)
                     {
-                        if (!nl->Text_0[0][m_language].empty() || !nl->Text_1[0][m_language].empty())
-                            title = !nl->Text_0[0][m_language].empty() ? nl->Text_1[0][m_language] : nl->Text_0[0][m_language];
+                        NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textid);
+                        if (nl)
+                        {
+                            if (nl->Text_0[0].size() < loc_idx && !nl->Text_0[0][loc_idx].empty())
+                                title = nl->Text_0[0][loc_idx];
+                        }
                     }
                 }
+                else
+                {
+                    title = gossiptext->Options[0].Text_1;
+
+                    int loc_idx = GetSession()->GetSessionLanguageIndex();
+                    if (loc_idx >= 0)
+                    {
+                        NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textid);
+                        if (nl)
+                        {
+                            if (nl->Text_1[0].size() < loc_idx && !nl->Text_1[0][loc_idx].empty())
+                                title = nl->Text_1[0][loc_idx];
+                        }
+                    }
+                }
             }
         }
         PlayerTalkClass->SendQuestGiverQuestList( qe, title, guid );
Index: src/game/QueryHandler.cpp
===================================================================
--- src/game/QueryHandler.cpp	(revision 4648)
+++ src/game/QueryHandler.cpp	(working copy)
@@ -106,16 +106,16 @@
         Name = ci->Name;
         SubName = ci->SubName;
 
-        uint8 m_language = GetSessionLanguage();
-        if (m_language > 0)
+        int loc_idx = GetSessionLanguageIndex();
+        if (loc_idx >= 0)
         {
             CreatureLocale const *cl = objmgr.GetCreatureLocale(entry);
             if (cl)
             {
-                if (!cl->Name[m_language].empty())          // default to english
-                    Name = cl->Name[m_language];
-                if (!cl->SubName[m_language].empty())       // same
-                    SubName = cl->SubName[m_language];
+                if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty())
+                    Name = cl->Name[loc_idx];
+                if (cl->SubName.size() > loc_idx && !cl->SubName[loc_idx].empty())
+                    SubName = cl->SubName[loc_idx];
             }
         }
 
@@ -172,8 +172,8 @@
         std::string Name;
         Name = info->name;
 
-        uint8 m_language = GetSessionLanguage();
-        if (m_language > 0)
+        LocaleConstant m_language = GetSessionLanguage();
+        if (m_language > LOCALE_ENG)
         {
             GameObjectLocale const *gl = objmgr.GetGameObjectLocale(entryID);
             if (gl)
@@ -291,8 +291,8 @@
             Text_1[i]=pGossip->Options[i].Text_1;
         }
 
-        uint8 m_language = GetSessionLanguage();
-        if (m_language > 0)
+        LocaleConstant m_language = GetSessionLanguage();
+        if (m_language > LOCALE_ENG)
         {
             NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID);
             if (nl)
@@ -364,16 +364,18 @@
         else
         {
             std::string Text = pPage->Text;
-            uint8 m_language = GetSessionLanguage();
-            if (m_language > 0)
+
+            int loc_idx = GetSessionLanguageIndex();
+            if (loc_idx >= 0)
             {
                 PageTextLocale const *pl = objmgr.GetPageTextLocale(pageID);
                 if (pl)
                 {
-                    if (!pl->Text[m_language].empty())
-                        Text = pl->Text[m_language];
+                    if (pl->Text.size() > loc_idx && !pl->Text[loc_idx].empty())
+                        Text = pl->Text[loc_idx];
                 }
             }
+
             data << Text;
             data << uint32(pPage->Next_Page);
             pageID = pPage->Next_Page;
Index: src/game/World.cpp
===================================================================
--- src/game/World.cpp	(revision 4648)
+++ src/game/World.cpp	(working copy)
@@ -480,9 +480,6 @@
         exit(1);
     }
 
-    std::string localization = sConfig.GetStringDefault("StringLocalize", "");
-    FillSupportedLocals(localization);
-
     ///- Update the realm entry in the database with the realm type from the config file
     //No SQL injection as values are treated as integers
     loginDatabase.PExecute("UPDATE `realmlist` SET `icon` = %u WHERE `id` = '%d'", m_configs[CONFIG_GAME_TYPE],realmID);
@@ -502,17 +499,13 @@
     sLog.outString( "Packing instances..." );
     objmgr.PackInstances();
 
-    ///- Load static data tables from the database
-    if (m_SupportedLocals.size()>0)
-    {
-        sLog.outString( "Loading Localization strings..." );
-        objmgr.LoadCreatureLocales();
-        objmgr.LoadGameObjectLocales();
-        objmgr.LoadItemLocales();
-        objmgr.LoadQuestLocales();
-        objmgr.LoadNpcTextLocales();
-        objmgr.LoadPageTextLocales();
-    }
+    sLog.outString( "Loading Localization strings..." );
+    objmgr.LoadCreatureLocales();
+    objmgr.LoadGameObjectLocales();
+    objmgr.LoadItemLocales();
+    objmgr.LoadQuestLocales();
+    objmgr.LoadNpcTextLocales();
+    objmgr.LoadPageTextLocales();
 
     sLog.outString( "Loading Game Object Templates..." );
     objmgr.LoadGameobjectInfo();
@@ -1723,32 +1716,6 @@
     }
 }
 
-void World::FillSupportedLocals(std::string str)
-{
-    if(str=="")
-    {
-        return; // English by default if none selected
-    }
-    int local;
-    std::istringstream ss(str);
-    for(int i = 0; i < 8; ++i)
-    {
-        ss >> local;
-        if (local > 0 && local <8)
-            SetSupportedLocals((uint8) local);
-        if(!ss)
-            break;
-    }
-    if (m_SupportedLocals.empty())
-    {
-        sLog.outError("Unable to determine your Locales!!");
-        exit(1);
-    }
-    LocalizationMap::const_iterator itr;
-    for (itr = m_SupportedLocals.begin(); itr != m_SupportedLocals.end(); ++itr)
-        sLog.outString("Support for local %u will be used",*itr);
-}
-
 void World::InitDailyQuestResetTime()
 {
     time_t mostRecentQuestTime;
Index: src/game/World.h
===================================================================
--- src/game/World.h	(revision 4648)
+++ src/game/World.h	(working copy)
@@ -350,17 +350,11 @@
         void InitResultQueue();
 
         void UpdateRealmCharCount(uint32 accid);
-
-        typedef std::set<uint8> LocalizationMap;
-        LocalizationMap const* GetSupportedLocals() const { return &m_SupportedLocals; }
-
     protected:
         void _UpdateGameTime();
         void ScriptsProcess();
         // callback for UpdateRealmCharacters
         void _UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId);
-        void SetSupportedLocals(uint8 local) { m_SupportedLocals.insert(local); }
-        void FillSupportedLocals(std::string str);
 
         void InitDailyQuestResetTime();
         void ResetDailyQuests();
@@ -404,9 +398,6 @@
         ZThread::LockedQueue<CliCommandHolder*, ZThread::FastMutex> cliCmdQueue;
         SqlResultQueue *m_resultQueue;
 
-        // Localization
-        LocalizationMap m_SupportedLocals;
-
         // next daily quests reset time
         time_t m_NextDailyQuestReset;
 };
Index: src/game/WorldSession.cpp
===================================================================
--- src/game/WorldSession.cpp	(revision 4648)
+++ src/game/WorldSession.cpp	(working copy)
@@ -40,9 +40,9 @@
 #include "Chat.h"
 
 /// WorldSession constructor
-WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, uint8 locale) :
+WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale) :
 LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time),
-_player(NULL), _socket(sock),_security(sec), _accountId(id), m_isTBC(tbc), m_sessionLanguage(locale),
+_player(NULL), _socket(sock),_security(sec), _accountId(id), m_isTBC(tbc), m_sessionLanguageIndex(objmgr.GetIndexForLocale(locale)),
 _logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false)
 {
     FillOpcodeHandlerHashTable();
Index: src/game/WorldSession.h
===================================================================
--- src/game/WorldSession.h	(revision 4648)
+++ src/game/WorldSession.h	(working copy)
@@ -65,7 +65,7 @@
 {
     friend class CharacterHandler;
     public:
-        WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, uint8 locale);
+        WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale);
         ~WorldSession();
 
         bool PlayerLoading() { return m_playerLoading; }
@@ -174,7 +174,7 @@
         time_t m_muteTime;
 
         // Locales
-        uint8 GetSessionLanguage() { return m_sessionLanguage; }
+        int GetSessionLanguageIndex() { return m_sessionLanguageIndex; }
     protected:
 
         void HandleCharEnumOpcode(WorldPacket& recvPacket);
@@ -567,7 +567,7 @@
         bool m_playerLoading;                               // code processed in LoginPlayer
         bool m_playerLogout;                                // code processed in LogoutPlayer
         bool m_playerRecentlyLogout;
-        uint8 m_sessionLanguage;
+        int m_sessionLanguageIndex;
 
         void FillOpcodeHandlerHashTable();
 
Index: src/game/WorldSocket.cpp
===================================================================
--- src/game/WorldSocket.cpp	(revision 4648)
+++ src/game/WorldSocket.cpp	(working copy)
@@ -249,7 +249,7 @@
     std::string safe_account=account;                       // Duplicate, else will screw the SHA hash verification below
     loginDatabase.escape_string(safe_account);
     //No SQL injection, username escaped.
-    //                                                 0    1         2            3         4         5           6    7    8     9   10
+    //                                                 0    1         2            3         4         5    6    7    8     9          10
     QueryResult *result = loginDatabase.PQuery("SELECT `id`,`gmlevel`,`sessionkey`,`last_ip`,`locked`, `I`, `v`, `s`, `tbc`,`mutetime`,`locale` FROM `account` WHERE `username` = '%s'", safe_account.c_str());
 
     ///- Stop if the account is not found
@@ -322,7 +322,11 @@
     security = fields[1].GetUInt16();
     K.SetHexStr(fields[2].GetString());
     time_t mutetime = time_t(fields[9].GetUInt64());
+    
     locale = fields[10].GetUInt8();
+    if (locale>=MAX_LOCALE)
+        locale=LOCALE_ENG;
+
     delete result;
 
     ///- Re-check account ban (same check as in realmd) /// TO DO: why on earth do 2 checks for same thing?
@@ -404,7 +408,7 @@
     SendPacket(&packet);
 
     ///- Create a new WorldSession for the player and add it to the World
-    _session = new WorldSession(id, this,security,tbc,mutetime,locale);
+    _session = new WorldSession(id, this,security,tbc,mutetime,LocaleConstant(locale));
     sWorld.AddSession(_session);
 
     if(sLog.IsOutDebug())                                   // optimize disabled debug output
Index: src/mangosd/mangosd.conf.in
===================================================================
--- src/mangosd/mangosd.conf.in	(revision 4648)
+++ src/mangosd/mangosd.conf.in	(working copy)
@@ -54,14 +54,6 @@
 # 255 = Auto Detect (Default)
 DBC.Locale = 255
 
-# Full localization support activation
-# Use the same codes as for DBC language to enable localization support in this language
-# Be informed that activating it consumes some memory (around 57MB per language activated)
-# ex: StringLocalize = "2" will activate French on top of default English
-# You can activate several languages like StringLocalize = "2 3" for French and German
-# StringLocalize = "" (Default = Disabled)
-StringLocalize = ""
-
 # Enable logging of GM commands - all SQL code will be written to a log file
 # All commands are written to a file: YYYY-MM-DD_logSQL.sql
 # If a new day starts (00:00:00) then a new file is created - the old
Index: src/realmd/AuthSocket.cpp
===================================================================
--- src/realmd/AuthSocket.cpp	(revision 4648)
+++ src/realmd/AuthSocket.cpp	(working copy)
@@ -468,12 +468,14 @@
                         {
                             _localization=(*localeresult)[0].GetUInt8();
                             delete localeresult;
+
+                            if (_localization>=MAX_LOCALE)
+                                _localization=LOCALE_ENG;
                         }
                         else
                             _localization=LOCALE_ENG; 
-                        if (_localization>=MAX_LOCALE)
-                            _localization=LOCALE_ENG;
-                        sLog.outBasic("[AuthChallenge] acount %s is using '%c%c' locale (%u)", _login.c_str (), ch->country[3],ch->country[2], _localization);
+
+                        sLog.outBasic("[AuthChallenge] account %s is using '%c%c' locale (%u)", _login.c_str (), ch->country[3],ch->country[2], _localization);
                     }
                 }
                 delete result;
Index: src/shared/Common.h
===================================================================
--- src/shared/Common.h	(revision 4648)
+++ src/shared/Common.h	(working copy)
@@ -149,7 +149,7 @@
     SEC_ADMINISTRATOR  = 3
 };
 
-enum LocalesConstants
+enum LocaleConstant
 {
     LOCALE_ENG = 0,
     LOCALE_FR  = 2,