diff options
-rw-r--r-- | include/m_langpack.h | 8 | ||||
-rw-r--r-- | src/modules/langpack/langpack.cpp | 19 | ||||
-rw-r--r-- | src/modules/langpack/lpservices.cpp | 11 |
3 files changed, 32 insertions, 6 deletions
diff --git a/include/m_langpack.h b/include/m_langpack.h index cdcd401d59..da15c63ea0 100644 --- a/include/m_langpack.h +++ b/include/m_langpack.h @@ -191,11 +191,15 @@ __inline static INT_PTR Langpack_PCharToTChar(const char* str) #define MS_LANGPACK_REGISTER "LangPack/Register"
#if defined( MIRANDA_CUSTOM_LP )
-
__forceinline void mir_getLP( const PLUGININFOEX* pInfo )
{ CallService(MS_LANGPACK_REGISTER, (WPARAM)&hLangpack, (LPARAM)pInfo);
}
-
#endif
+//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"
+
#endif // M_LANGPACK_H__
diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp index 8950bc61c5..cec6511386 100644 --- a/src/modules/langpack/langpack.cpp +++ b/src/modules/langpack/langpack.cpp @@ -539,10 +539,9 @@ int LoadLangPackModule(void) void UnloadLangPackModule()
{
- int i;
-
if ( !bModuleInitialized ) return;
+ int i;
for ( i=0; i < lMuuids.getCount(); i++ )
mir_free( lMuuids[i] );
lMuuids.destroy();
@@ -555,8 +554,7 @@ void UnloadLangPackModule() mir_free( p2->local);
mir_free( p2->wlocal);
mir_free( p2 );
- }
- }
+ } }
mir_free( p->local );
mir_free( p->wlocal );
@@ -567,3 +565,16 @@ void UnloadLangPackModule() langPack.entry=0;
langPack.entryCount=0;
} }
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+INT_PTR ReloadLangpack(WPARAM wParam, LPARAM lParam)
+{
+ TCHAR* pszStr = ( TCHAR* )lParam;
+ if ( pszStr == NULL )
+ pszStr = langPack.filename;
+
+ UnloadLangPackModule();
+ LoadLangPack(pszStr);
+ return 0;
+}
diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index 3f7ae689e6..48c0aea155 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -124,16 +124,22 @@ static INT_PTR LPRegister(WPARAM wParam, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR GetDefaultCodePage(WPARAM,LPARAM)
{
return LangPackGetDefaultCodePage();
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR GetDefaultLocale(WPARAM, LPARAM)
{
return LangPackGetDefaultLocale();
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR PcharToTchar(WPARAM wParam, LPARAM lParam)
{
char* pszStr = ( char* )lParam;
@@ -154,6 +160,10 @@ static INT_PTR PcharToTchar(WPARAM wParam, LPARAM lParam) #endif
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+INT_PTR ReloadLangpack(WPARAM wParam, LPARAM lParam);
+
int LoadLangPackServices(void)
{
CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING,TranslateString);
@@ -163,6 +173,7 @@ int LoadLangPackServices(void) CreateServiceFunction(MS_LANGPACK_GETLOCALE,GetDefaultLocale);
CreateServiceFunction(MS_LANGPACK_PCHARTOTCHAR,PcharToTchar);
CreateServiceFunction(MS_LANGPACK_REGISTER,LPRegister);
+ CreateServiceFunction(MS_LANGPACK_RELOAD,ReloadLangpack);
return 0;
}
|