cl_main: set language according to LANG variable
This commit is contained in:
parent
c36cfccdf0
commit
9dd2d20e78
2 changed files with 27 additions and 4 deletions
|
@ -72,6 +72,7 @@
|
||||||
#include "replay_internal.h"
|
#include "replay_internal.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "language.h"
|
||||||
#include "igame.h"
|
#include "igame.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
|
@ -2743,14 +2744,18 @@ void CL_InitLanguageCvar()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *szLang = getenv("LANG");
|
||||||
|
|
||||||
if ( CommandLine()->CheckParm( "-language" ) )
|
if ( CommandLine()->CheckParm( "-language" ) )
|
||||||
{
|
|
||||||
cl_language.SetValue( CommandLine()->ParmValue( "-language", "english") );
|
cl_language.SetValue( CommandLine()->ParmValue( "-language", "english") );
|
||||||
|
else if( szLang )
|
||||||
|
{
|
||||||
|
ELanguage lang = PchLanguageICUCodeToELanguage(szLang, k_Lang_English);
|
||||||
|
char *szShortLang = GetLanguageShortName(lang);
|
||||||
|
cl_language.SetValue( szShortLang );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
cl_language.SetValue( "english" );
|
cl_language.SetValue( "english" );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,16 @@ public:
|
||||||
return BaseClass::AddMenuItem(item);
|
return BaseClass::AddMenuItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int AddMenuItem(const char *itemName, wchar_t *itemText, const char *command, Panel *target, KeyValues *userData = NULL)
|
||||||
|
{
|
||||||
|
MenuItem *item = new CGameMenuItem(this, itemName);
|
||||||
|
item->AddActionSignalTarget(target);
|
||||||
|
item->SetCommand(command);
|
||||||
|
item->SetText(itemText);
|
||||||
|
item->SetUserData(userData);
|
||||||
|
return BaseClass::AddMenuItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
virtual int AddMenuItem(const char *itemName, const char *itemText, KeyValues *command, Panel *target, KeyValues *userData = NULL)
|
virtual int AddMenuItem(const char *itemName, const char *itemText, KeyValues *command, Panel *target, KeyValues *userData = NULL)
|
||||||
{
|
{
|
||||||
CGameMenuItem *item = new CGameMenuItem(this, itemName);
|
CGameMenuItem *item = new CGameMenuItem(this, itemName);
|
||||||
|
@ -586,6 +596,9 @@ public:
|
||||||
KeyValues *kv1 = menuItem1->GetUserData();
|
KeyValues *kv1 = menuItem1->GetUserData();
|
||||||
KeyValues *kv2 = menuItem2->GetUserData();
|
KeyValues *kv2 = menuItem2->GetUserData();
|
||||||
|
|
||||||
|
if( !kv1 || !kv2 )
|
||||||
|
continue;
|
||||||
|
|
||||||
if ( kv1->GetInt("InGameOrder") > kv2->GetInt("InGameOrder") )
|
if ( kv1->GetInt("InGameOrder") > kv2->GetInt("InGameOrder") )
|
||||||
MoveMenuItem( iID2, iID1 );
|
MoveMenuItem( iID2, iID1 );
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1491,12 @@ CGameMenu *CBasePanel::RecursiveLoadGameMenu(KeyValues *datafile)
|
||||||
{
|
{
|
||||||
CGameMenu *menu = new CGameMenu(this, datafile->GetName());
|
CGameMenu *menu = new CGameMenu(this, datafile->GetName());
|
||||||
|
|
||||||
menu->AddMenuItem("Console", "CONSOLE", "OpenConsole", this);
|
wchar_t *pString = g_pVGuiLocalize->Find( "#GameUI_Console" );
|
||||||
|
|
||||||
|
if( pString )
|
||||||
|
menu->AddMenuItem("Console", V_wcsupr(pString), "OpenConsole", this);
|
||||||
|
else
|
||||||
|
menu->AddMenuItem("Console", "CONSOLE", "OpenConsole", this);
|
||||||
|
|
||||||
// loop through all the data adding items to the menu
|
// loop through all the data adding items to the menu
|
||||||
for (KeyValues *dat = datafile->GetFirstSubKey(); dat != NULL; dat = dat->GetNextKey())
|
for (KeyValues *dat = datafile->GetFirstSubKey(); dat != NULL; dat = dat->GetNextKey())
|
||||||
|
|
Loading…
Reference in a new issue