Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Localization init fix to take CVar into account #450

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
16 changes: 16 additions & 0 deletions dev/Code/CryEngine/CrySystem/SystemInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3258,6 +3258,22 @@ void CSystem::InitLocalization()
}

string language = m_pLocalizationManager->LangNameFromPILID(languageID);

//Check if language was set in settings or user.cfg
pCVar = m_env.pConsole != 0 ? m_env.pConsole->GetCVar("g_language") : 0;
if (pCVar)
{
string languageInCvar = pCVar->GetString();
if (m_pLocalizationManager->PILIDFromLangName(languageInCvar.c_str()) != ILocalizationManager::EPlatformIndependentLanguageID::ePILID_MAX_OR_INVALID)
{
language = languageInCvar; //Language was set and valid so we use that one
}
else
{
pCVar->Set(language); //Language is invalid, set default in CVar
}
}

m_pLocalizationManager->SetLanguage(language.c_str());
if (m_pLocalizationManager->GetLocalizationFormat() == 1)
{
Expand Down