30
30
#include < MMSystem.h>
31
31
#include < ShlObj.h>
32
32
#include < string>
33
+ #include < stdio.h>
33
34
34
35
extern DWORD g_appStartupTime;
35
36
36
- CefString ClientApp::GetCurrentLanguage ( )
37
+ CefString GetLanguageFromId (LANGID langID )
37
38
{
38
- // Get the user's selected language
39
- // Defaults to the system installed language if not using MUI.
40
- LANGID langID = GetUserDefaultUILanguage ();
41
-
42
39
// Convert LANGID to a RFC 4646 language tag (per navigator.language)
43
40
int langSize = GetLocaleInfo (langID, LOCALE_SISO639LANGNAME, NULL , 0 );
44
41
int countrySize = GetLocaleInfo (langID, LOCALE_SISO3166CTRYNAME, NULL , 0 );
@@ -59,6 +56,35 @@ CefString ClientApp::GetCurrentLanguage()
59
56
return CefString (locale);
60
57
}
61
58
59
+ CefString ClientApp::GetCurrentLanguage ()
60
+ {
61
+ // Get the user's selected language
62
+ // Defaults to the system installed language if not using MUI.
63
+ LANGID langID = GetUserDefaultUILanguage ();
64
+ return GetLanguageFromId (langID);
65
+ }
66
+
67
+
68
+ CefString ClientApp::GetCurrentKeyboardLayout ()
69
+ {
70
+ // Get the user's active keyboard layout language
71
+ int kbd = (int )GetKeyboardLayout (0 );
72
+ LANGID langID = MAKELANGID (kbd & 0xFFFF , kbd & 0xFFFF0000 );
73
+ return GetLanguageFromId (langID);
74
+ }
75
+
76
+ CefString ClientApp::GetKeyboardType ()
77
+ {
78
+ // Get the user's active keyboard device type
79
+ int keyboardLayout = ((int )GetKeyboardLayout (0 ) & 0xFFFF0000 ) >> 16 ;
80
+ wchar_t *type = new wchar_t [10 ];
81
+ int len = swprintf_s (type, 10 , L" %d" , keyboardLayout);
82
+ std::wstring keyboardType (type);
83
+
84
+ delete [] type;
85
+ return CefString (keyboardType);
86
+ }
87
+
62
88
std::string ClientApp::GetExtensionJSSource ()
63
89
{
64
90
extern HINSTANCE hInst;
0 commit comments