diff --git a/framework/Common.cpp b/framework/Common.cpp index 80db02ff6..95ead1364 100644 --- a/framework/Common.cpp +++ b/framework/Common.cpp @@ -98,9 +98,6 @@ idCVar com_videoRam( "com_videoRam", "64", CVAR_INTEGER | CVAR_SYSTEM | CVAR_NOC idCVar com_product_lang_ext( "com_product_lang_ext", "1", CVAR_INTEGER | CVAR_SYSTEM | CVAR_ARCHIVE, "Extension to use when creating language files." ); -// Tels: can be removed when D3 is open source and we can access sys_lang properly -idCVar cv_tdm_lang("tdm_lang", "english", CVAR_GUI | CVAR_ARCHIVE, "The current used language. Possible values are 'english', 'german', 'russian' etc." ); - // com_speeds times int time_gameFrame; @@ -217,8 +214,6 @@ class idCommonLocal : public idCommon { int gameDLL; - idLangDict languageDict; // legacy - #ifdef ID_WRITE_VERSION idCompressor * config_compressor; #endif @@ -1711,12 +1706,8 @@ idCommonLocal::GetLanguageDict */ const idLangDict *idCommonLocal::GetLanguageDict( void ) { -#if 0 - return &languageDict; -#endif - // Redirect the call to I18N - return GetI18N()->GetLanguageDict(); + return i18n->GetLanguageDict(); } I18N* idCommonLocal::GetI18N() @@ -1749,39 +1740,8 @@ idCommonLocal::InitLanguageDict =============== */ void idCommonLocal::InitLanguageDict( void ) { - idStr fileName; - languageDict.Clear(); - - //D3XP: Instead of just loading a single lang file for each language - //we are going to load all files that begin with the language name - //similar to the way pak files work. So you can place english001.lang - //to add new strings to the english language dictionary - idFileList* langFiles; - langFiles = fileSystem->ListFilesTree( "strings", ".lang", true ); - - idStrList langList = langFiles->GetList(); StartupVariable( "sys_lang", false ); // let it be set on the command line - this is needed because this init happens very early - idStr langName = cvarSystem->GetCVarString( "sys_lang" ); - - //Loop through the list and filter - idStrList currentLangList = langList; - FilterLangList(¤tLangList, langName); - - if ( currentLangList.Num() == 0 ) { - // reset cvar to default and try to load again - cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reset sys_lang" ); - langName = cvarSystem->GetCVarString( "sys_lang" ); - currentLangList = langList; - FilterLangList(¤tLangList, langName); - } - - for( int i = 0; i < currentLangList.Num(); i++ ) { - //common->Printf("%s\n", currentLangList[i].c_str()); - languageDict.Load( currentLangList[i], false ); - } - - fileSystem->FreeFileList(langFiles); Sys_InitScanTable(); } @@ -3037,9 +2997,6 @@ void idCommonLocal::Shutdown( void ) { warningCaption.Clear(); errorList.Clear(); - // free language dictionary - languageDict.Clear(); - // enable leak test Mem_EnableLeakTest( "doom" ); diff --git a/framework/I18N.cpp b/framework/I18N.cpp index 0990d3091..f8d93fbfa 100644 --- a/framework/I18N.cpp +++ b/framework/I18N.cpp @@ -137,7 +137,7 @@ I18NLocal::Init void I18NLocal::Init() { // some default values, the object becomes only fully usable after Init(), tho: - m_lang = cvarSystem->GetCVarString( "tdm_lang" ); + m_lang = cvarSystem->GetCVarString( "sys_lang" ); m_bMoveArticles = (m_lang != "polish" && m_lang != "italian") ? true : false; m_Dict.Clear(); @@ -184,7 +184,7 @@ void I18NLocal::Init() m_Remap.Empty(); // by default, no remaps // Create the correct dictionary - SetLanguage( cvarSystem->GetCVarString( "tdm_lang" ), true ); + SetLanguage( cvarSystem->GetCVarString( "sys_lang" ), true ); } /* @@ -370,32 +370,14 @@ void I18NLocal::SetLanguage( const char* lang, bool firstTime ) { m_lang = lang; // set sys_lang - cvarSystem->SetCVarString("tdm_lang", lang); + cvarSystem->SetCVarString("sys_lang", lang); m_bMoveArticles = (m_lang != "polish" && m_lang != "italian") ? true : false; - idStr newLang = idStr(lang); - // If we need to remap some characters upon loading one of these languages: - LoadCharacterMapping(newLang); - - // For some reason, "english", "german", "french" and "spanish" share - // the same font, but "polish" and "russian" get their own font. But - // since "polish" is actually a copy of the normal western font, use - // "english" instead to trick D3 into loading the correct font. The - // dictionary below will be polish, regardless. - if (newLang == "polish") - { - newLang = "english"; - } - // set sysvar sys_lang (if not possible, D3 will revert to english) - cvarSystem->SetCVarString( "sys_lang", newLang.c_str() ); + LoadCharacterMapping(m_lang); - // If sys_lang differs from lang, the language was not supported, so - // we will load it ourselves. - if ( newLang != cvarSystem->GetCVarString( "sys_lang" ) ) - { - common->Printf("I18NLocal: Language '%s' not supported by D3, forcing it.\n", lang); - } + // set sysvar sys_lang + cvarSystem->SetCVarString( "sys_lang", m_lang.c_str() ); // build our combined dictionary, first the TDM base dict idStr file = "strings/"; file += m_lang + ".lang"; diff --git a/sys/sys_local.cpp b/sys/sys_local.cpp index 4336633f4..7eb0ffc49 100644 --- a/sys/sys_local.cpp +++ b/sys/sys_local.cpp @@ -23,12 +23,7 @@ static bool versioned = RegisterVersionedFile("$Id$"); #include "sys_local.h" -const char * sysLanguageNames[] = { - "english", "spanish", "italian", "german", "french", "russian", - "polish", "korean", "japanese", "chinese", NULL -}; - -idCVar sys_lang( "sys_lang", "english", CVAR_SYSTEM | CVAR_ARCHIVE, "", sysLanguageNames, idCmdSystem::ArgCompletion_String ); +idCVar sys_lang( "sys_lang", "english", CVAR_SYSTEM | CVAR_ARCHIVE, "The current used language. Possible values are 'english', 'german', 'russian' etc." ); idSysLocal sysLocal; idSys * sys = &sysLocal; diff --git a/ui/DeviceContext.cpp b/ui/DeviceContext.cpp index 3b553a9b3..1f99cdc3e 100644 --- a/ui/DeviceContext.cpp +++ b/ui/DeviceContext.cpp @@ -70,7 +70,7 @@ void idDeviceContext::SetupFonts() { fontLang = cvarSystem->GetCVarString( "sys_lang" ); // western european languages can use the english font - if ( fontLang == "french" || fontLang == "german" || fontLang == "spanish" || fontLang == "italian" ) { + if ( fontLang == "french" || fontLang == "german" || fontLang == "spanish" || fontLang == "italian" || fontLang == "polish") { fontLang = "english"; }