Rev 122 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#ifndef __LANGUAGES_H__
#define __LANGUAGES_H__
#include "Utils\String.h"
#include <map>
#include <vector>
enum Lang_Section
{
LS_STARTUP,
LS_FILEDIALOG
};
enum
{
LANGSTARTUP_ANOTHERINSTANCE_TITLE,
LANGSTARTUP_ANOTHERINSTANCE,
LANGSTARTUP_PROTECTEDDIR,
LANGSTARTUP_LOCKEDDIR,
LANGSTARTUP_LOCKEDDIR_TITLE,
};
#define LANGMAP std::map<Utils::String, Utils::String>
typedef struct SLanguageTexts {
int iLang;
LANGMAP texts;
} SLanguageTexts;
class SPKEXPORT CLanguages
{
public:
static CLanguages *Instance();
static void Release();
void SetLanguage(int lang) { m_iLanguage = lang; }
Utils::String findText(int section, int id);
protected:
CLanguages();
~CLanguages();
private:
Utils::String GetText(int section, int id)
{
switch(section)
{
case LS_STARTUP:
return GetText_Startup(id);
}
return _error(section, id);
}
Utils::String GetText_Startup(int id)
{
switch(id)
{
case LANGSTARTUP_ANOTHERINSTANCE_TITLE:
return "Another Instance Detected";
case LANGSTARTUP_ANOTHERINSTANCE:
return "Another instance of the plugin manager is already running";
case LANGSTARTUP_PROTECTEDDIR:
return "";
case LANGSTARTUP_LOCKEDDIR_TITLE:
return "Directory Locked";
case LANGSTARTUP_LOCKEDDIR:
return "ERROR: The game directory:\n%s\n\nIs locked and unable to add/remove any plugins";
}
return _error(LS_STARTUP, id);
}
SLanguageTexts *_findLanguageText(int id = -1);
Utils::String _error(int section, int id)
{
return "ReadText" + Utils::String::Number(section) + "-" + Utils::String::Number(id);
}
private:
static CLanguages *_pInstance;
int m_iLanguage;
std::vector<SLanguageTexts> *_lLanguages;
};
#endif //__LANGUAGES_H__