OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginSystem.h" | 3 #include "PluginSystem.h" |
4 #include "PluginClient.h" | 4 #include "PluginClient.h" |
5 | 5 |
6 std::wstring GetBrowserLanguage() | 6 std::wstring GetBrowserLanguage() |
7 { | 7 { |
8 LANGID lcid = GetUserDefaultLangID(); | 8 LANGID lcid = GetUserDefaultLangID(); |
9 TCHAR language[128]; | 9 wchar_t language[128]; |
10 memset(language, 0, sizeof(language)); | 10 memset(language, 0, sizeof(language)); |
11 TCHAR country[128]; | 11 wchar_t country[128]; |
12 memset(language, 0, sizeof(country)); | 12 memset(language, 0, sizeof(country)); |
13 | 13 |
14 std::wstring lang; | 14 std::wstring lang; |
15 int res = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME, language, 127); | 15 int res = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME, language, 127); |
16 if (res == 0) | 16 if (res == 0) |
17 { | 17 { |
18 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_SYSINFO, PLUGIN_ERROR_SYSINFO
_BROWSER_LANGUAGE, "System::GetBrowserLang - Failed"); | 18 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_SYSINFO, PLUGIN_ERROR_SYSINFO
_BROWSER_LANGUAGE, "System::GetBrowserLang - Failed"); |
19 } | 19 } |
20 else | 20 else |
21 { | 21 { |
22 lang += language; | 22 lang += language; |
23 } | 23 } |
24 lang += L"-"; | 24 lang += L"-"; |
25 res = GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME, country, 127); | 25 res = GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME, country, 127); |
26 if (res == 0) | 26 if (res == 0) |
27 { | 27 { |
28 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_SYSINFO, PLUGIN_ERROR_SYSINFO
_BROWSER_LANGUAGE, "System::GetBrowserLang - failed to retrieve country"); | 28 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_SYSINFO, PLUGIN_ERROR_SYSINFO
_BROWSER_LANGUAGE, "System::GetBrowserLang - failed to retrieve country"); |
29 } | 29 } |
30 else | 30 else |
31 { | 31 { |
32 lang += country; | 32 lang += country; |
33 } | 33 } |
34 return lang; | 34 return lang; |
35 } | 35 } |
OLD | NEW |