2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project 64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "..\support.h"
|
|
|
|
|
|
|
|
#pragma warning(disable:4786)
|
|
|
|
#include <string> //stl string
|
|
|
|
#include <map> //stl map
|
|
|
|
#include <list> //stl list
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
typedef std::map<int, std::wstring, std::less<int> > LANG_STRINGS;
|
2008-09-18 03:15:49 +00:00
|
|
|
typedef LANG_STRINGS::value_type LANG_STR;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
stdstr Filename;
|
2015-03-04 09:36:08 +00:00
|
|
|
std::wstring LanguageName;
|
2008-09-18 03:15:49 +00:00
|
|
|
} LanguageFile;
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
typedef std::list<LanguageFile> LanguageList;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2012-11-19 11:05:30 +00:00
|
|
|
class CLanguage
|
|
|
|
{
|
2012-10-04 20:42:51 +00:00
|
|
|
public:
|
2015-03-04 09:36:08 +00:00
|
|
|
CLanguage ();
|
|
|
|
|
|
|
|
const std::wstring & GetString ( LanguageStringID StringID );
|
|
|
|
LanguageList & GetLangList ( void );
|
|
|
|
void SetLanguage ( const wchar_t * LanguageName );
|
|
|
|
void LoadCurrentStrings ( bool ShowSelectDialog );
|
|
|
|
bool IsCurrentLang ( LanguageFile & File );
|
2012-10-04 20:42:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CLanguage(const CLanguage&); // Disable copy constructor
|
|
|
|
CLanguage& operator=(const CLanguage&); // Disable assignment
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
std::wstring m_SelectedLanguage;
|
|
|
|
const std::wstring m_emptyString;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2012-11-19 11:05:30 +00:00
|
|
|
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
|
2008-09-18 03:15:49 +00:00
|
|
|
LanguageList m_LanguageList;
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
std::wstring GetLangString ( const char * FileName, LanguageStringID ID );
|
|
|
|
LANG_STR GetNextLangString ( void * OpenFile );
|
|
|
|
void LoadDefaultStrings ( void );
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
extern CLanguage * g_Lang;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
inline LPCWSTR GS (LanguageStringID StringID)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-03-04 09:36:08 +00:00
|
|
|
return g_Lang->GetString(StringID).c_str();
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|