Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #64 from adobe/randy/localize-menus

Windows: localized native menus
  • Loading branch information...
commit 299c62c48f1e0f4fb71caf104524d57f548470a5 2 parents e750cb8 + 66c6167
@jasonsanjose jasonsanjose authored
View
24 appshell/cefclient.rc
@@ -68,6 +68,30 @@ BEGIN
END
END
+IDC_CEFCLIENT_FR MENU
+BEGIN
+ POPUP "&Fichier"
+ BEGIN
+ MENUITEM "&Quitter", IDM_EXIT
+ END
+ POPUP "&Ai_de"
+ BEGIN
+ MENUITEM "&A propos", IDM_ABOUT
+ END
+END
+
+IDC_CEFCLIENT_POPUP_FR MENU
+BEGIN
+ POPUP "&Fichier"
+ BEGIN
+ MENUITEM "&Fermer", IDM_CLOSE
+ END
+ POPUP "&Ai_de"
+ BEGIN
+ MENUITEM "&A propos", IDM_ABOUT
+ END
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
View
27 appshell/cefclient_win.cpp
@@ -41,7 +41,7 @@ char szWorkingDir[MAX_PATH]; // The current working directory
TCHAR szInitialUrl[MAX_PATH] = {0};
// Forward declarations of functions included in this code module:
-ATOM MyRegisterClass(HINSTANCE hInstance);
+ATOM MyRegisterClass(HINSTANCE hInstance, const cef_string_t& locale);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
@@ -98,7 +98,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING);
- MyRegisterClass(hInstance);
+ MyRegisterClass(hInstance, settings.locale);
HKEY hKey;
DWORD lResult;
@@ -162,7 +162,15 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
if (!InitInstance (hInstance, nCmdShow))
return FALSE;
- hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CEFCLIENT));
+ // Temporary localization hack. Default to English. Check for French.
+ DWORD menuId = IDC_CEFCLIENT;
+ if (settings.locale.str && (settings.locale.length > 0) &&
+ (CefString(settings.locale.str) == CefString("fr-FR")))
+ {
+ menuId = IDC_CEFCLIENT_FR;
+ }
+
+ hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(menuId));
int result = 0;
@@ -205,7 +213,16 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
// function so that the application will get 'well formed' small icons
// associated with it.
//
-ATOM MyRegisterClass(HINSTANCE hInstance) {
+ATOM MyRegisterClass(HINSTANCE hInstance, const cef_string_t& locale) {
+
+ // Temporary localization hack. Default to English. Check for French.
+ DWORD menuId = IDC_CEFCLIENT;
+ if (locale.str && (locale.length > 0) &&
+ (CefString(locale.str) == CefString("fr-FR")))
+ {
+ menuId = IDC_CEFCLIENT_FR;
+ }
+
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
@@ -218,7 +235,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance) {
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT);
+ wcex.lpszMenuName = MAKEINTRESOURCE(menuId);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
View
2  appshell/resource.h
@@ -17,6 +17,8 @@
#define IDI_SMALL 108
#define IDC_CEFCLIENT 109
#define IDC_CEFCLIENT_POPUP 110
+#define IDC_CEFCLIENT_FR 111
+#define IDC_CEFCLIENT_POPUP_FR 112
#define IDR_MAINFRAME 128
#define IDC_NAV_BACK 200
#define IDC_NAV_FORWARD 201
Please sign in to comment.
Something went wrong with that request. Please try again.