MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / SetLanguageModule

Method SetLanguageModule

Explorer++/Explorer++/Language.cpp:18–212  ·  view source on GitHub ↗

* Selects which language resource DLL based * on user preferences and system language. * The default language is English. */

Source from the content-addressed store, hash-verified

16* The default language is English.
17*/
18void Explorerplusplus::SetLanguageModule()
19{
20 HANDLE hFindFile;
21 WIN32_FIND_DATA wfd;
22 LANGID languageId;
23 TCHAR szLanguageModule[MAX_PATH];
24 TCHAR szNamePattern[MAX_PATH];
25 TCHAR szFullFileName[MAX_PATH];
26 TCHAR szName[MAX_PATH];
27 WORD wLanguage;
28 BOOL bRet;
29
30 if(g_bForceLanguageLoad)
31 {
32 /* Language has been forced on the command
33 line by the user. Attempt to find the
34 corresponding DLL. */
35 GetProcessImageName(GetCurrentProcessId(), szLanguageModule, SIZEOF_ARRAY(szLanguageModule));
36 PathRemoveFileSpec(szLanguageModule);
37 StringCchPrintf(szName, SIZEOF_ARRAY(szName), _T("Explorer++%s.dll"), g_szLang);
38 PathAppend(szLanguageModule, szName);
39
40 bRet = GetFileLanguage(szLanguageModule, &wLanguage);
41
42 if(bRet)
43 {
44 m_config->language = wLanguage;
45 }
46 }
47 else
48 {
49 if(!m_bLanguageLoaded)
50 {
51 /* No previous language loaded. Try and use the system
52 default language. */
53 languageId = GetUserDefaultUILanguage();
54
55 m_config->language = PRIMARYLANGID(languageId);
56 }
57 }
58
59 if(m_config->language == LANG_ENGLISH)
60 {
61 m_hLanguageModule = GetModuleHandle(nullptr);
62 }
63 else
64 {
65 GetProcessImageName(GetCurrentProcessId(), szLanguageModule, SIZEOF_ARRAY(szLanguageModule));
66 PathRemoveFileSpec(szLanguageModule);
67
68 StringCchCopy(szNamePattern, SIZEOF_ARRAY(szNamePattern), szLanguageModule);
69 PathAppend(szNamePattern, NExplorerplusplus::LANGUAGE_DLL_FILENAME_PATTERN);
70
71 hFindFile = FindFirstFile(szNamePattern, &wfd);
72
73 /* Loop through the current translation DLL's to
74 try and find one that matches the specified
75 language. */

Callers

nothing calls this directly

Calls 4

GetProcessImageNameFunction · 0.85
GetFileLanguageFunction · 0.85
LoadStringFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected