mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Merge pull request #55 from Deledrius/l10n
Re-enable Localization. Fixes #12
This commit is contained in:
@ -1486,7 +1486,18 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
plLocalization::SetDefaultLanguage();
|
// Load an optional general.ini
|
||||||
|
wchar gipath[MAX_PATH];
|
||||||
|
PathGetInitDirectory(gipath, arrsize(gipath));
|
||||||
|
PathAddFilename(gipath, gipath, L"general.ini", arrsize(gipath));
|
||||||
|
FILE *generalini = _wfopen(gipath, L"rb");
|
||||||
|
if (generalini)
|
||||||
|
{
|
||||||
|
fclose(generalini);
|
||||||
|
pfConsoleEngine tempConsole;
|
||||||
|
tempConsole.ExecuteFile(gipath);
|
||||||
|
}
|
||||||
|
|
||||||
// If another instance is running, exit. We'll automatically release our
|
// If another instance is running, exit. We'll automatically release our
|
||||||
// lock on the mutex when our process exits
|
// lock on the mutex when our process exits
|
||||||
HANDLE hOneInstance = CreateMutex(nil, FALSE, "UruExplorer");
|
HANDLE hOneInstance = CreateMutex(nil, FALSE, "UruExplorer");
|
||||||
@ -1500,13 +1511,13 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
|||||||
case plLocalization::kGerman:
|
case plLocalization::kGerman:
|
||||||
hsMessageBox("URU wird bereits in einer anderen Instanz ausgef<65>hrt", "Fehler", hsMessageBoxNormal);
|
hsMessageBox("URU wird bereits in einer anderen Instanz ausgef<65>hrt", "Fehler", hsMessageBoxNormal);
|
||||||
break;
|
break;
|
||||||
/* case plLocalization::kSpanish:
|
case plLocalization::kSpanish:
|
||||||
hsMessageBox("En estos momentos se est<73> ejecutando otra copia de URU", "Error", hsMessageBoxNormal);
|
hsMessageBox("En estos momentos se est<73> ejecutando otra copia de URU", "Error", hsMessageBoxNormal);
|
||||||
break;
|
break;
|
||||||
case plLocalization::kItalian:
|
case plLocalization::kItalian:
|
||||||
hsMessageBox("Un'altra copia di URU <20> gi<67> aperta", "Errore", hsMessageBoxNormal);
|
hsMessageBox("Un'altra copia di URU <20> gi<67> aperta", "Errore", hsMessageBoxNormal);
|
||||||
break;
|
break;
|
||||||
*/ // default is English
|
// default is English
|
||||||
default:
|
default:
|
||||||
hsMessageBox("Another copy of URU is already running", "Error", hsMessageBoxNormal);
|
hsMessageBox("Another copy of URU is already running", "Error", hsMessageBoxNormal);
|
||||||
break;
|
break;
|
||||||
|
@ -2581,7 +2581,6 @@ PF_CONSOLE_CMD(App,
|
|||||||
|
|
||||||
#endif // LIMIT_CONSOLE_COMMANDS
|
#endif // LIMIT_CONSOLE_COMMANDS
|
||||||
|
|
||||||
#ifdef LIMIT_CONSOLE_COMMANDS // for now, disable languages in external clients
|
|
||||||
PF_CONSOLE_CMD(App,
|
PF_CONSOLE_CMD(App,
|
||||||
SetLanguage,
|
SetLanguage,
|
||||||
"string language",
|
"string language",
|
||||||
@ -2607,7 +2606,6 @@ PF_CONSOLE_CMD(App,
|
|||||||
plLocalization::SetLanguage(plLocalization::kJapanese);
|
plLocalization::SetLanguage(plLocalization::kJapanese);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // LIMIT_CONSOLE_COMMANDS
|
|
||||||
|
|
||||||
PF_CONSOLE_CMD(App,
|
PF_CONSOLE_CMD(App,
|
||||||
DemoMode,
|
DemoMode,
|
||||||
|
@ -204,57 +204,3 @@ std::vector<std::wstring> plLocalization::StringToLocal(const std::wstring & loc
|
|||||||
retVal[0] = localizedText; // if no tags were in the text, we assume it to be English
|
retVal[0] = localizedText; // if no tags were in the text, we assume it to be English
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "hsWindows.h"
|
|
||||||
|
|
||||||
void plLocalization::SetDefaultLanguage()
|
|
||||||
{
|
|
||||||
fLanguage = kEnglish;
|
|
||||||
#if 0 // disable all languages
|
|
||||||
#ifdef HS_BUILD_FOR_WIN32
|
|
||||||
HKEY hLocalKey = NULL;
|
|
||||||
HKEY hMSKey = NULL;
|
|
||||||
HKEY hWindowsKey = NULL;
|
|
||||||
HKEY hCurVerKey = NULL;
|
|
||||||
HKEY hUninstKey = NULL;
|
|
||||||
HKEY hUruKey = NULL;
|
|
||||||
|
|
||||||
#define RegOpen(key, retKey, subKeyName) RegOpenKeyEx(key, subKeyName, 0, KEY_READ, &retKey) == ERROR_SUCCESS
|
|
||||||
|
|
||||||
if (RegOpen(HKEY_LOCAL_MACHINE, hLocalKey, "software") &&
|
|
||||||
RegOpen(hLocalKey, hMSKey, "microsoft") &&
|
|
||||||
RegOpen(hMSKey, hWindowsKey, "windows") &&
|
|
||||||
RegOpen(hWindowsKey, hCurVerKey, "currentversion") &&
|
|
||||||
RegOpen(hCurVerKey, hUninstKey, "uninstall") &&
|
|
||||||
RegOpen(hUninstKey, hUruKey, "Uru - Ages Beyond Myst"))
|
|
||||||
{
|
|
||||||
char value[20];
|
|
||||||
DWORD bufsize = sizeof(value);
|
|
||||||
if (RegQueryValueEx(hUruKey, "Lang", NULL, NULL, (LPBYTE)value, &bufsize) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
if (hsStrEQ(value, "en"))
|
|
||||||
fLanguage = kEnglish;
|
|
||||||
else if (hsStrEQ(value, "fr"))
|
|
||||||
fLanguage = kFrench;
|
|
||||||
else if (hsStrEQ(value, "de"))
|
|
||||||
fLanguage = kGerman;
|
|
||||||
else if (hsStrEQ(value, "es"))
|
|
||||||
fLanguage = kSpanish;
|
|
||||||
else if (hsStrEQ(value, "it"))
|
|
||||||
fLanguage = kItalian;
|
|
||||||
else if (hsStrEQ(value, "jp"))
|
|
||||||
fLanguage = kJapanese;
|
|
||||||
else
|
|
||||||
fLanguage = kEnglish;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(hLocalKey);
|
|
||||||
RegCloseKey(hMSKey);
|
|
||||||
RegCloseKey(hWindowsKey);
|
|
||||||
RegCloseKey(hCurVerKey);
|
|
||||||
RegCloseKey(hUninstKey);
|
|
||||||
RegCloseKey(hUruKey);
|
|
||||||
#endif // HS_BUILD_FOR_WIN32
|
|
||||||
#endif // 0
|
|
||||||
}
|
|
||||||
|
@ -83,9 +83,6 @@ protected:
|
|||||||
static hsBool IGetLocalized(const char* name, Language lang, char* localizedName);
|
static hsBool IGetLocalized(const char* name, Language lang, char* localizedName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Sets the default language, as determined by the installer
|
|
||||||
static void SetDefaultLanguage();
|
|
||||||
|
|
||||||
static void SetLanguage(Language lang) { fLanguage = lang; }
|
static void SetLanguage(Language lang) { fLanguage = lang; }
|
||||||
static Language GetLanguage() { return fLanguage; }
|
static Language GetLanguage() { return fLanguage; }
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ inline plKeyImp* IFindKeyLocalized(const plUoid& uoid, plRegistryPageNode* page)
|
|||||||
const char* objectName = uoid.GetObjectName();
|
const char* objectName = uoid.GetObjectName();
|
||||||
|
|
||||||
// If we're running localized, try to find a localized version first
|
// If we're running localized, try to find a localized version first
|
||||||
if (plLocalization::IsLocalized())
|
if ((objectName != nil) && plLocalization::IsLocalized())
|
||||||
{
|
{
|
||||||
char localName[256];
|
char localName[256];
|
||||||
if (plLocalization::GetLocalized(objectName, localName))
|
if (plLocalization::GetLocalized(objectName, localName))
|
||||||
|
Reference in New Issue
Block a user