exposed global translation file for core
authorDavid Anderson <dvander@alliedmods.net>
Sat Feb 17 09:00:14 2007 +0000 (2007-02-17)
changeset 515643240c66787
parent 514 4c02b38c26ed
child 516 0807e52b4e02
exposed global translation file for core
core/CTranslator.cpp
core/CTranslator.h
     1.1 --- a/core/CTranslator.cpp	Sat Feb 17 08:59:52 2007 +0000
     1.2 +++ b/core/CTranslator.cpp	Sat Feb 17 09:00:14 2007 +0000
     1.3 @@ -22,6 +22,7 @@
     1.4  #include "sourcemod.h"
     1.5  
     1.6  CTranslator g_Translator;
     1.7 +CPhraseFile *g_pCorePhrases = NULL;
     1.8  
     1.9  struct trans_t
    1.10  {
    1.11 @@ -574,6 +575,10 @@
    1.12  	return m_File.c_str();
    1.13  }
    1.14  
    1.15 +/**************************
    1.16 + ** MAIN TRANSLATOR CODE **
    1.17 + **************************/
    1.18 +
    1.19  CTranslator::CTranslator()
    1.20  {
    1.21  	m_pStringTab = new BaseStringTable(2048);
    1.22 @@ -597,6 +602,12 @@
    1.23  	delete m_pStringTab;
    1.24  }
    1.25  
    1.26 +void CTranslator::OnSourceModAllInitialized()
    1.27 +{
    1.28 +	unsigned int id = FindOrAddPhraseFile("core.cfg");
    1.29 +	g_pCorePhrases = GetFileByIndex(id);
    1.30 +}
    1.31 +
    1.32  bool CTranslator::GetLanguageByCode(const char *code, unsigned int *index)
    1.33  {
    1.34  	void *_index;
     2.1 --- a/core/CTranslator.h	Sat Feb 17 08:59:52 2007 +0000
     2.2 +++ b/core/CTranslator.h	Sat Feb 17 09:00:14 2007 +0000
     2.3 @@ -90,11 +90,15 @@
     2.4  	bool m_FileLogged;
     2.5  };
     2.6  
     2.7 -class CTranslator : public ITextListener_SMC
     2.8 +class CTranslator : 
     2.9 +	public ITextListener_SMC,
    2.10 +	public SMGlobalClass
    2.11  {
    2.12  public:
    2.13  	CTranslator();
    2.14  	~CTranslator();
    2.15 +public: //SMGlobalClass
    2.16 +	void OnSourceModAllInitialized();
    2.17  public: //ITextListener_SMC
    2.18  	void ReadSMC_ParseStart();
    2.19  	SMCParseResult ReadSMC_NewSection(const char *name, bool opt_quotes);
    2.20 @@ -117,6 +121,7 @@
    2.21  	String m_CustomError;
    2.22  };
    2.23  
    2.24 +extern CPhraseFile *g_pCorePhrases;
    2.25  extern CTranslator g_Translator;
    2.26  
    2.27  #endif //_INCLUDE_SOURCEMOD_TRANSLATOR_H_