mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- removed the automatic system language detection for Windows.
Default language is now always American English, just like on Linux and macOS.
This commit is contained in:
parent
04281d4a0b
commit
dbd6c2eabf
9 changed files with 25 additions and 127 deletions
|
@ -1243,10 +1243,12 @@ CCMD(secret)
|
|||
FString levelname;
|
||||
level_info_t *info = FindLevelInfo(mapname);
|
||||
const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()];
|
||||
levelname.Format("%s - %s\n", mapname, ln);
|
||||
size_t llen = levelname.Len() - 1;
|
||||
levelname.Format("%s - %s", mapname, ln);
|
||||
Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars());
|
||||
size_t llen = levelname.Len();
|
||||
levelname = "";
|
||||
for(size_t ii=0; ii<llen; ii++) levelname += '-';
|
||||
Printf(TEXTCOLOR_YELLOW"%s\n", levelname.GetChars());
|
||||
Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars());
|
||||
foundsome = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ CUSTOM_CVAR(Float, teamdamage, 0.f, CVAR_SERVERINFO | CVAR_NOINITCALL)
|
|||
|
||||
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
SetLanguageIDs();
|
||||
GStrings.UpdateLanguage();
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "d_player.h"
|
||||
#include "xlsxread/xlsxio_read.h"
|
||||
|
||||
EXTERN_CVAR(String, language)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -63,7 +64,6 @@ void FStringTable::LoadStrings ()
|
|||
if (!LoadLanguageFromSpreadsheet(lump))
|
||||
LoadLanguage (lump);
|
||||
}
|
||||
SetLanguageIDs();
|
||||
UpdateLanguage();
|
||||
allMacros.Clear();
|
||||
}
|
||||
|
@ -378,6 +378,12 @@ void FStringTable::InsertString(int langid, FName label, const FString &string)
|
|||
|
||||
void FStringTable::UpdateLanguage()
|
||||
{
|
||||
size_t langlen = strlen(language);
|
||||
|
||||
int LanguageID = (langlen < 2 || langlen > 3) ?
|
||||
MAKE_ID('e', 'n', 'u', '\0') :
|
||||
MAKE_ID(language[0], language[1], language[2], '\0');
|
||||
|
||||
currentLanguageSet.Clear();
|
||||
|
||||
auto checkone = [&](uint32_t lang_id)
|
||||
|
@ -389,11 +395,8 @@ void FStringTable::UpdateLanguage()
|
|||
|
||||
checkone(dehacked_table);
|
||||
checkone(global_table);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
checkone(LanguageIDs[i]);
|
||||
checkone(LanguageIDs[i] & MAKE_ID(0xff, 0xff, 0, 0));
|
||||
}
|
||||
checkone(LanguageID);
|
||||
checkone(LanguageID & MAKE_ID(0xff, 0xff, 0, 0));
|
||||
checkone(default_table);
|
||||
}
|
||||
|
||||
|
|
|
@ -1300,17 +1300,20 @@ int FTextureManager::PalCheck(int tex)
|
|||
// FTextureManager :: PalCheck
|
||||
//
|
||||
//==========================================================================
|
||||
EXTERN_CVAR(String, language)
|
||||
|
||||
int FTextureManager::ResolveLocalizedTexture(int tex)
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t lang = LanguageIDs[i];
|
||||
uint64_t index = (uint64_t(lang) << 32) + tex;
|
||||
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
|
||||
index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex;
|
||||
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
|
||||
}
|
||||
size_t langlen = strlen(language);
|
||||
int lang = (langlen < 2 || langlen > 3) ?
|
||||
MAKE_ID('e', 'n', 'u', '\0') :
|
||||
MAKE_ID(language[0], language[1], language[2], '\0');
|
||||
|
||||
uint64_t index = (uint64_t(lang) << 32) + tex;
|
||||
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
|
||||
index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex;
|
||||
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,21 +68,6 @@ ticcmd_t* I_BaseTiccmd()
|
|||
|
||||
|
||||
|
||||
//
|
||||
// SetLanguageIDs
|
||||
//
|
||||
void SetLanguageIDs()
|
||||
{
|
||||
size_t langlen = strlen(language);
|
||||
|
||||
uint32_t lang = (langlen < 2 || langlen > 3)
|
||||
? MAKE_ID('e', 'n', 'u', '\0')
|
||||
: MAKE_ID(language[0], language[1], language[2], '\0');
|
||||
|
||||
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
|
||||
}
|
||||
|
||||
|
||||
double PerfToSec, PerfToMillisec;
|
||||
|
||||
static void CalculateCPUSpeed()
|
||||
|
|
|
@ -45,16 +45,6 @@ struct WadStuff;
|
|||
#define SHARE_DIR "/usr/local/share/"
|
||||
#endif
|
||||
|
||||
// Index values into the LanguageIDs array
|
||||
enum
|
||||
{
|
||||
LANGIDX_UserPreferred,
|
||||
LANGIDX_UserDefault,
|
||||
LANGIDX_SysPreferred,
|
||||
LANGIDX_SysDefault
|
||||
};
|
||||
extern uint32_t LanguageIDs[4];
|
||||
extern void SetLanguageIDs ();
|
||||
|
||||
// Called by DoomMain.
|
||||
void I_Init (void);
|
||||
|
|
|
@ -92,20 +92,6 @@ void I_EndRead(void)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// SetLanguageIDs
|
||||
//
|
||||
void SetLanguageIDs ()
|
||||
{
|
||||
size_t langlen = strlen(language);
|
||||
|
||||
uint32_t lang = (langlen < 2 || langlen > 3) ?
|
||||
MAKE_ID('e','n','u','\0') :
|
||||
MAKE_ID(language[0],language[1],language[2],'\0');
|
||||
|
||||
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
|
||||
}
|
||||
|
||||
//
|
||||
// I_Init
|
||||
//
|
||||
|
|
|
@ -273,65 +273,6 @@ void I_DetectOS(void)
|
|||
info.dwBuildNumber, info.szCSDVersion);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SubsetLanguageIDs
|
||||
//
|
||||
// Helper function for SetLanguageIDs.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static void SubsetLanguageIDs(LCID id, LCTYPE type, int idx)
|
||||
{
|
||||
char buf[8];
|
||||
LCID langid;
|
||||
char *idp;
|
||||
|
||||
if (!GetLocaleInfoA(id, type, buf, 8))
|
||||
return;
|
||||
langid = MAKELCID(strtoul(buf, NULL, 16), SORT_DEFAULT);
|
||||
if (!GetLocaleInfoA(langid, LOCALE_SABBREVLANGNAME, buf, 8))
|
||||
return;
|
||||
idp = (char *)(&LanguageIDs[idx]);
|
||||
memset (idp, 0, 4);
|
||||
idp[0] = tolower(buf[0]);
|
||||
idp[1] = tolower(buf[1]);
|
||||
idp[2] = tolower(buf[2]);
|
||||
idp[3] = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SetLanguageIDs
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void SetLanguageIDs()
|
||||
{
|
||||
size_t langlen = strlen(language);
|
||||
|
||||
if (langlen < 2 || langlen > 3)
|
||||
{
|
||||
memset(LanguageIDs, 0, sizeof(LanguageIDs));
|
||||
SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, 0);
|
||||
SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 1);
|
||||
SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, 2);
|
||||
SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t lang = 0;
|
||||
|
||||
((uint8_t *)&lang)[0] = (language)[0];
|
||||
((uint8_t *)&lang)[1] = (language)[1];
|
||||
((uint8_t *)&lang)[2] = (language)[2];
|
||||
LanguageIDs[0] = lang;
|
||||
LanguageIDs[1] = lang;
|
||||
LanguageIDs[2] = lang;
|
||||
LanguageIDs[3] = lang;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CalculateCPUSpeed
|
||||
|
|
|
@ -34,17 +34,6 @@
|
|||
struct ticcmd_t;
|
||||
struct WadStuff;
|
||||
|
||||
// Index values into the LanguageIDs array
|
||||
enum
|
||||
{
|
||||
LANGIDX_UserPreferred,
|
||||
LANGIDX_UserDefault,
|
||||
LANGIDX_SysPreferred,
|
||||
LANGIDX_SysDefault
|
||||
};
|
||||
extern uint32_t LanguageIDs[4];
|
||||
extern void SetLanguageIDs ();
|
||||
|
||||
// [RH] Detects the OS the game is running under.
|
||||
void I_DetectOS (void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue