diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-18 21:20:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-18 21:20:39 +0000 |
commit | ec0e34b4f88ebe03ff12f559e40dda52c51549b7 (patch) | |
tree | 42e8a56fe17d9736527fe79a6345e857842fbf40 /include/m_langpack.h | |
parent | ca702593c60aa89c06633777feb7cf79ad8e751f (diff) |
langpack services module destroyed from mir_app
the only survived service moved to mir_core
git-svn-id: http://svn.miranda-ng.org/main/trunk@14250 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_langpack.h')
-rw-r--r-- | include/m_langpack.h | 134 |
1 files changed, 66 insertions, 68 deletions
diff --git a/include/m_langpack.h b/include/m_langpack.h index 87c1557c9e..581405ce8a 100644 --- a/include/m_langpack.h +++ b/include/m_langpack.h @@ -29,25 +29,45 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_core.h>
#endif
-#if !defined(_STATIC)
- #define MIRANDA_CUSTOM_LP
-#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(void) Langpack_SortDuplicates(void);
+
+EXTERN_C MIR_CORE_DLL(int) LoadLangPackModule(void);
+EXTERN_C MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack);
+EXTERN_C MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr);
+
+EXTERN_C MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLang);
+EXTERN_C MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t* str, int hLang);
+EXTERN_C MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang);
-//translates a single string into the user's local language v0.1.1.0+
-//wParam = 0
-//lParam = (LPARAM)(const char*)szEnglish
-//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 MS_LANGPACK_TRANSLATESTRING "LangPack/TranslateString"
+#define Translate(s) TranslateA_LP(s, hLangpack)
+#define TranslateW(s) TranslateW_LP(s, hLangpack)
+#define TranslateDialogDefault(h) TranslateDialog_LP(h,hLangpack)
+
+#ifdef _UNICODE
+ #define TranslateT(s) TranslateW_LP(_T(s),hLangpack)
+ #define TranslateTS(s) TranslateW_LP(s,hLangpack)
+ #define TranslateTH(l,s) TranslateW_LP(s,l)
+#else
+ #define TranslateT(s) TranslateA_LP(s,hLangpack)
+ #define TranslateTS(s) TranslateA_LP(s,hLangpack)
+ #define TranslateTH(l,s) TranslateA_LP(s,l)
+#endif
// 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
#ifdef _UNICODE
@@ -57,69 +77,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif
//Those macros do NOTHING. They are just markers for lpgen.pl.
-//translates a menu into the user's local language v0.1.1.0+
-//wParam = (WPARAM)(HMENU)hMenu
-//lParam = langpack handle (v.0.10.0+)
-//returns 0 on success, nonzero on failure
-#define MS_LANGPACK_TRANSLATEMENU "LangPack/TranslateMenu"
-
-//returns the codepage used in the language pack v0.4.3.0+
-//wParam = 0
-//lParam = 0
-//returns the codepage stated in the langpack, or CP_ACP if no langpack is present
-#define MS_LANGPACK_GETCODEPAGE "LangPack/GetCodePage"
-
-//returns the locale id associated with the language pack v0.4.3.0+
-//wParam = 0
-//lParam = 0
-//returns the Windows locale id stated in the langpack, or LOCALE_USER_DEFAULT if no langpack is present
-#define MS_LANGPACK_GETLOCALE "LangPack/GetLocale"
-
-//returns the strdup/wcsdup of lparam according to the langpack v0.4.3.0+
-//wParam = langpack handle (v.0.10.0+)
-//lParam = (LPARAM)(char*)source string
-//returns a string converted from char* to TCHAR* using the langpack codepage.
-//This string should be freed using mir_free() then
-#define MS_LANGPACK_PCHARTOTCHAR "LangPack/PcharToTchar"
-
-#if defined(MIRANDA_CUSTOM_LP)
-
-__forceinline INT_PTR Langpack_PCharToTChar(const char* str)
-{ return CallService(MS_LANGPACK_PCHARTOTCHAR, hLangpack, (LPARAM)str);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// translates a menu into the user's local language
+// returns 0 on success, nonzero on failure
-#else
+EXTERN_C MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, int = hLangpack);
-__forceinline INT_PTR Langpack_PCharToTChar(const char* str)
-{ return CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)str);
-}
+#define TranslateMenu(h) TranslateMenu_LP(h,hLangpack)
-#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns the codepage used in the language pack
+// returns the codepage stated in the langpack, or CP_ACP if no langpack is present
-//initializes the plugin-specific translation context v0.10.0+
-//wParam = pointer to the langpack handle
-//lParam = PLUGININFOEX* of the caller plugin
-//always returns 0
-#define MS_LANGPACK_REGISTER "LangPack/Register"
+EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultCodePage(void);
-#if defined(MIRANDA_CUSTOM_LP)
-__forceinline void mir_getLP(const PLUGININFOEX* pInfo)
-{ CallService(MS_LANGPACK_REGISTER, (WPARAM)&hLangpack, (LPARAM)pInfo);
-}
-#endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// 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 the strdup/wcsdup of lparam according to the langpack
+// returns a string converted from char* to TCHAR* using the langpack codepage.
+// This string should be freed using mir_free() then
+
+EXTERN_C MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// initializes the plugin-specific translation context v0.10.0+
+// always returns 0
+
+EXTERN_C MIR_CORE_DLL(void) mir_getLP(const PLUGININFOEX *pInfo, int *_hLang = &hLangpack);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// reloads langpack
+// wParam = 0 (ignored)
+// lParam = (LPARAM)(TCHAR*)langpack file name or NULL to reload the current one
+// always returns 0
-//reloads langpack
-//wParam = 0 (ignored)
-//lParam = (LPARAM)(TCHAR*)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"
-//retrieves the hLangpack of a plugin by its HINSTANCE
-//wParam = 0 (ignored)
-//lParam = (LPARAM)(HINSTANCE)plugin's base address
-//returns hLangpack if found, or 0 if error occurred
-#define MS_LANGPACK_LOOKUPHANDLE "LangPack/LookupHandle"
-
#endif // M_LANGPACK_H__
|