From 3d056db74316952258f6f4272fdc39546cf40eeb Mon Sep 17 00:00:00 2001 From: lx-s Date: Tue, 14 Nov 2023 20:38:34 +0100 Subject: [PATCH] Translated bluetooth-add-dlg --- Translations/wm_de/resource.h | 5 +++++ Translations/wm_de/wm_de.rc | Bin 11610 -> 12324 bytes WinMute/Settings_BluetoothDlg.cpp | 28 ++++++++++++++-------------- WinMute/WinMute.rc | 15 ++++++++++++++- WinMute/resource.h | 8 +++++++- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Translations/wm_de/resource.h b/Translations/wm_de/resource.h index edbfc49..ebeb704 100644 --- a/Translations/wm_de/resource.h +++ b/Translations/wm_de/resource.h @@ -48,6 +48,11 @@ #define IDS_TRAYMENU_MUTE_ALL_DEVICES 410 #define IDS_TRAYMENU_SETTINGS 411 #define IDS_TRAYMENU_EXIT 412 +#define IDS_SETTINGS_BTN_SAVE 1000 +#define IDS_SETTINGS_BTN_CANCEL 1001 +#define IDS_SETTINGS_BLUETOOTH_ADD_DLG_TITLE 1101 +#define IDS_SETTINGS_BLUETOOTH_EDIT_DLG_TITLE 1102 +#define IDS_SETTINGS_BLUETOOTH_ADD_DLG_DEVICE_NAME_LABEL 1103 // Next default values for new objects // diff --git a/Translations/wm_de/wm_de.rc b/Translations/wm_de/wm_de.rc index 50f980dc83436ba2c2ca25a840b1822412aa7dac..972ef3df9a071cdac66070a2b46ddae465ee1122 100644 GIT binary patch delta 414 zcma)2I|{-;6dVu)D~li@q!CMzh@GD*(I7$$NJ0vm^@E=jiikGeLiP$CK=3x!UclbM z*@#UrAj9(Bu*|%9?>@dvu2xlEwPq`Ti;x(=M;`$M95SCZfQ^X1& devices) btdi.dwSize = sizeof(btdi); HBLUETOOTH_DEVICE_FIND hBtDevFind = BluetoothFindFirstDevice(&bfrp, &btdi); if (hBtDevFind == nullptr) { - PrintWindowsError(L"BluetoothFindFirstDevice"); log.WriteWindowsError(L"BluetoothFindFirstDevice", GetLastError()); } else { do { @@ -66,6 +65,19 @@ static bool GetPairedBtAudioDevices(std::vector& devices) return false; } +static void LoadBluetoothAddDlgTranslation(HWND hDlg, bool isEdit) +{ + WMi18n &i18n = WMi18n::GetInstance(); + if (isEdit) { + i18n.SetItemText(hDlg, IDS_SETTINGS_BLUETOOTH_EDIT_DLG_TITLE); + } else { + i18n.SetItemText(hDlg, IDS_SETTINGS_BLUETOOTH_ADD_DLG_TITLE); + } + i18n.SetItemText(hDlg, IDC_LABEL_BT_DEVICE_NAME, IDS_SETTINGS_BLUETOOTH_ADD_DLG_DEVICE_NAME_LABEL); + i18n.SetItemText(hDlg, IDOK, IDS_SETTINGS_BTN_SAVE); + i18n.SetItemText(hDlg, IDCANCEL, IDS_SETTINGS_BTN_CANCEL); +} + static INT_PTR CALLBACK Settings_BluetoothAddDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -76,20 +88,8 @@ static INT_PTR CALLBACK Settings_BluetoothAddDlgProc(HWND hDlg, UINT msg, WPARAM return FALSE; } SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(btDeviceData)); + LoadBluetoothAddDlgTranslation(hDlg, btDeviceData->devName.length() == 0); - if (btDeviceData->devName.length() == 0) { - if (!SetWindowTextW(hDlg, L"Add Bluetooth device")) { - PrintWindowsError(L"SetWindowText", GetLastError()); - return FALSE; - } - } else { - if (!SetWindowTextW(hDlg, L"Edit Bluetooth device") - || !SetWindowTextW(GetDlgItem(hDlg, IDC_BT_DEVICE_NAME), - btDeviceData->devName.c_str())) { - PrintWindowsError(L"SetWindowText", GetLastError()); - return FALSE; - } - } // Fill Combobox std::vector registeredBtDevices; if (GetPairedBtAudioDevices(registeredBtDevices)) { diff --git a/WinMute/WinMute.rc b/WinMute/WinMute.rc index 4e9d6ec..6a2e07f 100644 --- a/WinMute/WinMute.rc +++ b/WinMute/WinMute.rc @@ -205,7 +205,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Save",IDOK,91,41,50,14 PUSHBUTTON "Cancel",IDCANCEL,144,41,50,14 - LTEXT "Bluetooth device name:",IDC_STATIC,7,7,187,14 + LTEXT "Bluetooth device name:",IDC_LABEL_BT_DEVICE_NAME,7,7,187,14 COMBOBOX IDC_BT_DEVICE_NAME,7,22,187,17,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP END @@ -626,6 +626,19 @@ BEGIN IDS_TRAYMENU_EXIT "Exit" END +STRINGTABLE +BEGIN + IDS_SETTINGS_BLUETOOTH_ADD_DLG_TITLE "Add bluetooth device" + IDS_SETTINGS_BLUETOOTH_EDIT_DLG_TITLE "Edit bluetooth device" + IDS_SETTINGS_BLUETOOTH_ADD_DLG_DEVICE_NAME_LABEL "Bluetooth device name:" +END + +STRINGTABLE +BEGIN + IDS_SETTINGS_BTN_SAVE "Save" + IDS_SETTINGS_BTN_CANCEL "Cancel" +END + #endif // English (United Kingdom) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/WinMute/resource.h b/WinMute/resource.h index 2d293ff..7573827 100644 --- a/WinMute/resource.h +++ b/WinMute/resource.h @@ -68,7 +68,9 @@ #define IDS_TRAYMENU_MUTE_ALL_DEVICES 410 #define IDS_TRAYMENU_SETTINGS 411 #define IDS_TRAYMENU_EXIT 412 +#define IDS_SETTINGS_BTN_SAVE 1000 #define IDC_LINK_HOMEPAGE 1001 +#define IDS_SETTINGS_BTN_CANCEL 1001 #define IDC_LINK_SUPPORT 1002 #define IDC_LINK_PROJECT 1002 #define IDC_ENABLEQUIETHOURS 1003 @@ -132,6 +134,10 @@ #define IDC_ENDPOINT_NAME 1049 #define IDC_MUTEDELAY 1050 #define IDC_LANGUAGE 1051 +#define IDC_LABEL_BT_DEVICE_NAME 1052 +#define IDS_SETTINGS_BLUETOOTH_ADD_DLG_TITLE 1101 +#define IDS_SETTINGS_BLUETOOTH_EDIT_DLG_TITLE 1102 +#define IDS_SETTINGS_BLUETOOTH_ADD_DLG_DEVICE_NAME_LABEL 1103 #define ID_TRAYMENU_INFO 40001 #define ID_TRAYMENU_ 40002 #define ID_TRAYMENU_MUTEON 40003 @@ -179,7 +185,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 140 #define _APS_NEXT_COMMAND_VALUE 40041 -#define _APS_NEXT_CONTROL_VALUE 1052 +#define _APS_NEXT_CONTROL_VALUE 1053 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- 2.43.0