core/Translator.cpp
changeset 1012 1ffc8b804b7d
parent 933 4b950183bb7b
child 1013 4225e70fba06
     1.1 --- a/core/Translator.cpp	Sun Jun 24 19:40:25 2007 +0000
     1.2 +++ b/core/Translator.cpp	Sun Jun 24 21:04:20 2007 +0000
     1.3 @@ -104,6 +104,13 @@
     1.4  	SMCParseError err;
     1.5  	char path[PLATFORM_MAX_PATH];
     1.6  	g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
     1.7 +
     1.8 +	/* :HACKHACK: If we're looking for a .txt, see if a .cfg also exists if our .txt does not. */
     1.9 +	if (!g_LibSys.PathExists(path))
    1.10 +	{
    1.11 +		UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg");
    1.12 +	}
    1.13 +
    1.14  	unsigned int line=0, col=0;
    1.15  
    1.16  	if ((err=g_TextParser.ParseFile_SMC(path, this, &line, &col)) != SMCParse_Okay)
    1.17 @@ -650,7 +657,20 @@
    1.18  void Translator::OnSourceModAllInitialized()
    1.19  {
    1.20  	AddLanguage("en", "English");
    1.21 -	unsigned int id = FindOrAddPhraseFile("core.cfg");
    1.22 +
    1.23 +	unsigned int id;
    1.24 +
    1.25 +	/* hack -- if core.cfg exists, exec it instead. */
    1.26 +	char path[PLATFORM_MAX_PATH];
    1.27 +	g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "translations/core.cfg");
    1.28 +	
    1.29 +	if (g_LibSys.PathExists(path))
    1.30 +	{
    1.31 +		id = FindOrAddPhraseFile("core.cfg");
    1.32 +	} else {
    1.33 +		id = FindOrAddPhraseFile("core.phrases.txt");
    1.34 +	}
    1.35 +
    1.36  	g_pCorePhrases = GetFileByIndex(id);
    1.37  }
    1.38