-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTranslator.h
34 lines (24 loc) · 910 Bytes
/
Translator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "LanguageIDs.h"
//////////////////////////////////////////////////////////////////////////
// Class for managing plugin interface translation.
class Translator
{
private:
// Translation map ID => text.
typedef map<DWORD, wstring> MapIdToString;
MapIdToString m_TranslationMap;
// Parses the language data from buffer in memory and updates the translation map.
bool ParseLanguageData(const WCHAR* LngData, size_t LngDataSz);
public:
Translator();
~Translator();
// Reads the language file and updates the translation map.
bool ReadLanguageFile(const WCHAR* FileName);
// Returns the translation text by its ID.
const wstring& GetLine(DWORD Id) const;
// Translate dialog controls according to the fixed mapping of controls to language IDs.
void TranslateDialog(HWND hwndDlg, const DWORD* LangIDs);
};
// Global translator object.
extern Translator GlobalTranslator;