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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
Miranda NG: the free IM client for Microsoft* Windows*
Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org)
Copyright (c) 2000-12 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef M_LANGPACK_H__
#define M_LANGPACK_H__
#if !defined(M_CORE_H__)
#include <m_core.h>
#endif
/////////////////////////////////////////////////////////////////////////////////////////
// translates a single string into the user's local language
// returns a pointer to the localised string. If there is no known translation
// it will return szEnglish. The return value does not need to be freed in any way
// Note that the Translate() macro as defined below will crash plugins that are
// loaded into Miranda 0.1.0.1 and earlier. If anyone's actually using one of
// these versions, I pity them.
#define LANG_UNICODE 0x1000
EXTERN_C MIR_CORE_DLL(int) LoadLangPackModule(void);
EXTERN_C MIR_CORE_DLL(int) LoadLangPack(const wchar_t *szLangPack);
EXTERN_C MIR_CORE_DLL(void) ReloadLangpack(wchar_t *pszStr);
EXTERN_C MIR_CORE_DLL(char*) TranslateA_LP(const char *str, HPLUGIN = nullptr);
EXTERN_C MIR_CORE_DLL(char*) TranslateU_LP(const char *str, HPLUGIN = nullptr);
EXTERN_C MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t *str, HPLUGIN = nullptr);
EXTERN_C MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, HPLUGIN = nullptr);
// if uuid == NULL, translations are loaded from the global section only
EXTERN_C MIR_CORE_DLL(wchar_t *) TranslateW_UUID(const wchar_t *str, const MUUID *uuid);
#define Translate(s) TranslateA_LP(s, &g_plugin)
#define TranslateU(s) TranslateU_LP(s, &g_plugin)
#define TranslateW(s) TranslateW_LP(s, &g_plugin)
#define TranslateT(s) TranslateW_LP(_A2W(s), &g_plugin)
#define TranslateDialogDefault(h) TranslateDialog_LP(h, &g_plugin)
// If you're storing some string for calling later-on Translate or using it
// with an API call that does translation automatically marked with
// [TRANSLATED-BY-CORE] please wrap it with one of LPGEN macros in order to
// generate proper language pack.
#define LPGEN(s) s
#define LPGENW(s) L ## s
//Those macros do NOTHING. They are just markers for lpgen.pl.
/////////////////////////////////////////////////////////////////////////////////////////
// translates a menu into the user's local language
// returns 0 on success, nonzero on failure
EXTERN_C MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, HPLUGIN = nullptr);
#define TranslateMenu(h) TranslateMenu_LP(h, &g_plugin)
/////////////////////////////////////////////////////////////////////////////////////////
// returns the codepage used in the language pack
// returns the codepage stated in the langpack, or CP_ACP if no langpack is present
EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultCodePage(void);
/////////////////////////////////////////////////////////////////////////////////////////
// returns the locale id associated with the language pack
// returns the Windows locale id stated in the langpack, or LOCALE_USER_DEFAULT if no langpack is present
EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
/////////////////////////////////////////////////////////////////////////////////////////
// returns 2-byte locale name associated with the language pack
// if locale is not set, returns "en"
MIR_CORE_DLL(char *) Langpack_GetDefaultLocaleName();
/////////////////////////////////////////////////////////////////////////////////////////
// reloads langpack
// wParam = 0 (ignored)
// lParam = (LPARAM)(wchar_t*)langpack file name or NULL to reload the current one
// always returns 0
#define MS_LANGPACK_RELOAD "LangPack/Reload"
#define ME_LANGPACK_CHANGED "LangPack/Changed"
#endif // M_LANGPACK_H__
|