summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-23 20:43:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-23 20:43:18 +0000
commit5a4ec571583845e2c6e7d005b400309072690d07 (patch)
treefa875f92541c68fc7d65f692bf9db6f501f7912f
parent908a56b91845eea1ffcdbd27458e2fa7c62c009f (diff)
new setting in a mirandaboot.ini:DefaultLanguage
git-svn-id: http://svn.miranda-ng.org/main/trunk@8721 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--src/core/modules.cpp2
-rw-r--r--src/mir_core/langpack.cpp16
-rw-r--r--src/modules/database/profilemanager.cpp2
-rw-r--r--src/modules/plugins/newplugins.cpp8
4 files changed, 19 insertions, 9 deletions
diff --git a/src/core/modules.cpp b/src/core/modules.cpp
index c567efce1d..d0fd58359e 100644
--- a/src/core/modules.cpp
+++ b/src/core/modules.cpp
@@ -91,7 +91,7 @@ int LoadDescButtonModule();
int LoadDefaultModules(void)
{
- //load order is very important for these
+ // load order is very important for these
if (LoadSystemModule()) return 1;
if (LoadLangpackModule()) return 1; // langpack will be a system module in the new order so this is moved here
if (CheckRestart()) return 1;
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp
index 2fadf0f073..009185407a 100644
--- a/src/mir_core/langpack.cpp
+++ b/src/mir_core/langpack.cpp
@@ -359,11 +359,16 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start
MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack)
{
- lstrcpy(langPack.tszFileName, szLangPack);
- lstrcpy(langPack.tszFullPath, szLangPack);
+ if (!lstrcmp(szLangPack, langPack.tszFullPath))
+ return 0;
+
+ if (g_entryCount)
+ UnloadLangPackModule();
+
+ _tcsncpy_s(langPack.tszFullPath, SIZEOF(langPack.tszFullPath), szLangPack, _TRUNCATE);
TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\');
- if (p)
- p[1] = 0;
+ _tcsncpy_s(langPack.tszFileName, SIZEOF(langPack.tszFullPath), (p == NULL) ? szLangPack : p + 1, _TRUNCATE);
+ CharLower(langPack.tszFileName);
FILE *fp = _tfopen(szLangPack, _T("rt"));
if (fp == NULL)
@@ -379,7 +384,6 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack)
// body
fseek(fp, startOfLine, SEEK_SET);
- g_entriesAlloced = 0;
LoadLangPackFile(fp, line, fileCp);
fclose(fp);
@@ -640,7 +644,7 @@ void UnloadLangPackModule()
if (g_entryCount) {
mir_free(g_pEntries);
g_pEntries = 0;
- g_entryCount = 0;
+ g_entryCount = g_entriesAlloced = 0;
}
}
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp
index 66b721b2d2..05c44aa603 100644
--- a/src/modules/database/profilemanager.cpp
+++ b/src/modules/database/profilemanager.cpp
@@ -74,8 +74,6 @@ struct ProfileEnumData
TCHAR* szProfile;
};
-extern TCHAR mirandabootini[MAX_PATH];
-
void SetServiceModePlugin(pluginEntry *p);
static void ThemeDialogBackground(HWND hwnd)
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index 5a9dcb55fa..8a33ddbea1 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -818,6 +818,14 @@ int LoadNewPluginsModuleInfos(void)
// remember where the mirandaboot.ini goes
PathToAbsoluteT(_T("mirandaboot.ini"), mirandabootini);
+
+ TCHAR tszDefaultLang[100];
+ if (GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszDefaultLang, SIZEOF(tszDefaultLang), mirandabootini)) {
+ TCHAR tszLangPath[MAX_PATH];
+ PathToAbsoluteT(tszDefaultLang, tszLangPath);
+ LoadLangPack(tszLangPath);
+ }
+
// look for all *.dll's
enumPlugins(scanPluginsDir, 0, 0);