diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-25 14:19:43 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-25 14:19:43 +0000 |
commit | 88f6179361e5b378c2938c77674d28cd1dc9a4ed (patch) | |
tree | 8ad248bd753a5e7643057a43c5a8bd78d3789017 /src/modules/langpack | |
parent | 86e8851bf37227b9f70f88e1788c7355422ee3b0 (diff) |
- language packs' directory is now %miranda_path%\Languages
- lang pack loading code restructurization
git-svn-id: http://svn.miranda-ng.org/main/trunk@8738 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/langpack')
-rw-r--r-- | src/modules/langpack/langpack.cpp | 53 | ||||
-rw-r--r-- | src/modules/langpack/langpack.h | 2 | ||||
-rw-r--r-- | src/modules/langpack/lpopts.cpp | 4 | ||||
-rw-r--r-- | src/modules/langpack/lpservices.cpp | 2 |
4 files changed, 4 insertions, 57 deletions
diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp index b0beb9c673..c378373e45 100644 --- a/src/modules/langpack/langpack.cpp +++ b/src/modules/langpack/langpack.cpp @@ -37,7 +37,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
LANGPACK_INFO pack;
- PathToAbsoluteT(_T("\\langpack_*.txt"), pack.tszFullPath);
+ PathToAbsoluteT(_T("\\Languages\\langpack_*.txt"), pack.tszFullPath);
BOOL fPackFound = FALSE;
WIN32_FIND_DATA wfd;
@@ -47,7 +47,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
/* get data */
TCHAR tszFullPath[MAX_PATH];
- PathToAbsoluteT(_T("\\"), tszFullPath);
+ PathToAbsoluteT(_T("\\Languages\\"), tszFullPath);
lstrcat(tszFullPath, wfd.cFileName);
ZeroMemory(&pack, sizeof(pack));
@@ -93,52 +93,3 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) return fPackFound;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void Langpack_LoadLangpack(void)
-{
- TCHAR szSearch[MAX_PATH];
- PathToAbsoluteT(_T("\\"), szSearch);
-
- // try to get the langpack's name from a profile first
- ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
- if (langpack && langpack[0] != '\0') {
- lstrcat(szSearch, langpack);
-
- DWORD dwAttrib = GetFileAttributes(szSearch);
- if (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
- if (!LoadLangPack(szSearch))
- return;
- }
-
- // look into mirandaboot.ini
- TCHAR tszDefaultLang[100];
- if (GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszDefaultLang, SIZEOF(tszDefaultLang), mirandabootini)) {
- TCHAR tszLangPath[MAX_PATH];
- PathToAbsoluteT(tszDefaultLang, tszLangPath);
- if (!LoadLangPack(tszLangPath))
- return;
- }
-
- // finally try to load first file
- lstrcat(szSearch, _T("langpack_*.txt"));
-
- WIN32_FIND_DATA fd;
- HANDLE hFind = FindFirstFile(szSearch, &fd);
- if (hFind != INVALID_HANDLE_VALUE) {
- do {
- /* search first langpack that could be loaded */
- if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
- /* load langpack */
- PathToAbsoluteT(_T("\\"), szSearch);
- lstrcat(szSearch, fd.cFileName);
- if (!LoadLangPack(szSearch)) {
- db_set_ws(NULL, "Langpack", "Current", fd.cFileName);
- break;
- }
- }
- while (FindNextFile(hFind, &fd));
- FindClose(hFind);
- }
-}
diff --git a/src/modules/langpack/langpack.h b/src/modules/langpack/langpack.h index 47f44de94d..9d6401c71e 100644 --- a/src/modules/langpack/langpack.h +++ b/src/modules/langpack/langpack.h @@ -59,5 +59,3 @@ typedef BOOL(*ENUM_PACKS_CALLBACK) (LANGPACK_INFO *pack, WPARAM wParam, LPARAM l BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam);
int LangpackOptionsInit(WPARAM wParam, LPARAM);
-
-void Langpack_LoadLangpack(void);
diff --git a/src/modules/langpack/lpopts.cpp b/src/modules/langpack/lpopts.cpp index f52254afff..376f74fcc9 100644 --- a/src/modules/langpack/lpopts.cpp +++ b/src/modules/langpack/lpopts.cpp @@ -152,7 +152,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int idx = ComboBox_GetCurSel(hwndList);
int count = ComboBox_GetCount(hwndList);
for (int i = 0; i < count; i++) {
- LANGPACK_INFO *pack = (LANGPACK_INFO*)ComboBox_GetItemData(hwndList, idx);
+ LANGPACK_INFO *pack = (LANGPACK_INFO*)ComboBox_GetItemData(hwndList, i);
if (i == idx) {
db_set_ws(NULL, "Langpack", "Current", pack->tszFileName);
lstrcpy(tszPath, pack->tszFullPath);
@@ -162,7 +162,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
if (tszPath[0]) {
- CallService(MS_LANGPACK_RELOAD, 0, (LPARAM)tszPath);
+ ReloadLangpack(tszPath);
CloseWindow(GetParent(hwndDlg));
DestroyWindow(GetParent(hwndDlg));
}
diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index c686200e91..472ba43541 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -97,8 +97,6 @@ static INT_PTR srvGetPluginLangpack(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_CORE_DLL(int)LoadLangPackModule(void);
-
int LoadLangpackModule(void)
{
LoadLangPackModule();
|