From 394ed5d867402b8dec51094281492c1552d5478e Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 25 Jun 2023 00:41:02 +0200 Subject: Windows: Better language localization support for Expander. More work is needed to localize remaining string resources --- src/Common/Language.xml | 2 ++ src/ExpandVolume/DlgExpandVolume.cpp | 4 ++++ src/ExpandVolume/ExpandVolume.rc | 6 +++--- src/ExpandVolume/WinMain.cpp | 26 +++++++++++++++++++++++++- src/ExpandVolume/resource.h | 3 ++- 5 files changed, 36 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Common/Language.xml b/src/Common/Language.xml index 7c001179..b5855e29 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -1572,6 +1572,8 @@ VeraCrypt cannot be upgraded because the system partition/drive was encrypted using an algorithm that is not supported anymore.\nPlease decrypt your system before upgrading VeraCrypt and then encrypt it again. Supported terminal application could not be found, you need either xterm, konsole or gnome-terminal (with dbus-x11). Mount Without Cache + :: VeraCrypt Expander ::\n\nExpand a VeraCrypt volume on the fly without reformatting\n\n\nAll kind of volumes (container files, disks and partitions) formatted with NTFS are supported. The only condition is that there must be enough free space on the host drive or host device of the VeraCrypt volume.\n\nDo not use this software to expand an outer volume containing a hidden volume, because this destroys the hidden volume!\n + 1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index ab76d1ba..eb3b06f6 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -147,6 +147,8 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA pVolExpandParam = (EXPAND_VOL_THREAD_PARAMS*)lParam; + LocalizeDialog (hwndDlg, NULL); + EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), !pVolExpandParam->bIsDevice); EnableWindow (GetDlgItem (hwndDlg, IDC_KB), !pVolExpandParam->bIsDevice); EnableWindow (GetDlgItem (hwndDlg, IDC_MB), !pVolExpandParam->bIsDevice); @@ -309,6 +311,8 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered)); VirtualLock (maskRandPool, sizeof(maskRandPool)); + LocalizeDialog (hwndDlg, NULL); + mouseEntropyGathered = 0xFFFFFFFF; mouseEventsInitialCount = 0; bUseMask = FALSE; diff --git a/src/ExpandVolume/ExpandVolume.rc b/src/ExpandVolume/ExpandVolume.rc index 76e4cf10..2da61a18 100644 --- a/src/ExpandVolume/ExpandVolume.rc +++ b/src/ExpandVolume/ExpandVolume.rc @@ -40,7 +40,7 @@ BEGIN CONTROL "Fill new space with random data",IDC_INIT_NEWSPACE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,120,276,10 CONTROL "Quick Expand",IDC_QUICKEXPAND,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,30,132,276,10 - DEFPUSHBUTTON "Continue",IDOK,15,238,84,18 + DEFPUSHBUTTON "Continue",IDC_CONTINUE,15,238,84,18 PUSHBUTTON "Cancel",IDCANCEL,277,238,84,18 LTEXT "Help Text",IDC_BOX_HELP,15,165,346,58,0,WS_EX_CLIENTEDGE GROUPBOX "Enter new volume size",IDC_STATIC,15,83,346,63 @@ -73,7 +73,7 @@ BEGIN GROUPBOX "",IDC_STATIC,282,238,88,24 GROUPBOX "",IDC_STATIC,6,238,88,24 GROUPBOX "",IDC_STATIC,1,147,373,123,BS_CENTER - LTEXT "1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button",IDC_STATIC,15,156,293,21 + LTEXT "1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button",IDC_STEPSEXPAND,15,156,293,21 LTEXT "Static",IDC_INFOEXPAND,8,6,361,134,SS_NOPREFIX | SS_SUNKEN,WS_EX_STATICEDGE END @@ -121,7 +121,7 @@ BEGIN RTEXT "Volume: ",IDT_VOL_NAME,31,16,42,8 GROUPBOX "",IDC_STATIC,15,7,346,72 CONTROL "",IDC_EXPAND_VOLUME_NAME,"Static",SS_SIMPLE | WS_GROUP,80,16,275,8,WS_EX_TRANSPARENT - DEFPUSHBUTTON "Continue",IDOK,15,247,84,18 + DEFPUSHBUTTON "Continue",IDC_CONTINUE,15,247,84,18 PUSHBUTTON "Cancel",IDCANCEL,277,247,84,18 EDITTEXT IDC_BOX_STATUS,15,176,346,66,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL CONTROL "",IDC_EXPAND_VOLUME_INITSPACE,"Static",SS_SIMPLE | WS_GROUP,80,64,275,8,WS_EX_TRANSPARENT diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index bcaaefa8..42f1c28d 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -199,6 +199,10 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet) static void InitMainDialog (HWND hwndDlg) { + MENUITEMINFOW info; + int i; + wchar_t *str; + int menuEntries[] = {IDM_ABOUT, IDM_HOMEPAGE}; /* Call the common dialog init code */ InitDialog (hwndDlg); LocalizeDialog (hwndDlg, NULL); @@ -207,7 +211,27 @@ static void InitMainDialog (HWND hwndDlg) SetWindowTextW (hwndDlg, lpszTitle); SendMessage (GetDlgItem (hwndDlg, IDC_INFOEXPAND), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE); - SetWindowText (GetDlgItem (hwndDlg, IDC_INFOEXPAND), szExpandVolumeInfo); + SetWindowText (GetDlgItem (hwndDlg, IDC_INFOEXPAND), GetString("EXPANDER_INFO")); + + // Localize menu strings + for (i = 0; i < array_capacity (menuEntries); i++) + { + str = (wchar_t *)GetDictionaryValueByInt (menuEntries[i]); + if (str) + { + ZeroMemory (&info, sizeof(info)); + info.cbSize = sizeof (info); + info.fMask = MIIM_TYPE; + info.fType = MFT_STRING; + if (GetMenuItemInfoW (GetMenu (hwndDlg), menuEntries[i], FALSE, &info)) + { + info.dwTypeData = str; + info.cch = (UINT) wcslen (str); + + SetMenuItemInfoW (GetMenu (hwndDlg), menuEntries[i], FALSE, &info); + } + } + } // Resize the logo bitmap if the user has a non-default DPI if (ScreenDPI != USER_DEFAULT_SCREEN_DPI diff --git a/src/ExpandVolume/resource.h b/src/ExpandVolume/resource.h index 99d89dda..51fe1c0c 100644 --- a/src/ExpandVolume/resource.h +++ b/src/ExpandVolume/resource.h @@ -72,6 +72,7 @@ #define IDC_OLD_PIM_HELP 1144 #define ID_HOMEPAGE 1145 #define IDC_QUICKEXPAND 1146 +#define IDC_STEPSEXPAND 1147 #define IDM_HELP 40001 #define IDM_ABOUT 40002 #define IDM_UNMOUNT_VOLUME 40003 @@ -142,7 +143,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 120 #define _APS_NEXT_COMMAND_VALUE 40064 -#define _APS_NEXT_CONTROL_VALUE 1147 +#define _APS_NEXT_CONTROL_VALUE 1148 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3