Make theme warning message translatable (switching unsaved theme to another)

Fix report from comment: #8972 (comment).

Close #13112
This commit is contained in:
ArkadiuszMichalski 2023-02-13 13:12:46 +01:00 committed by Don Ho
parent f7fcab4c21
commit 0c704fd66b
3 changed files with 13 additions and 6 deletions

View File

@ -1418,6 +1418,8 @@ Continue?"/>
<ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/> <!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. --> <ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/> <!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
<WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/> <WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/>
<LanguageMenuCompactWarning title="Compact Language Menu" message="This option will be changed on the next launch."/> <!-- HowToReproduce: toggle "Make language menu compact" via Preferences dialog "Language/Language Menu. --> <LanguageMenuCompactWarning title="Compact Language Menu" message="This option will be changed on the next launch."/> <!-- HowToReproduce: toggle "Make language menu compact" via Preferences dialog "Language/Language Menu. -->
<SwitchUnsavedThemeWarning title="$STR_REPLACE$" message="Unsaved changes are about to be discarded!
Do you want to save your changes before switching themes?"/> <!-- HowToReproduce: In the Style Configurator dialog change some theme and switch to other theme without saving. -->
</MessageBox> </MessageBox>
<ClipboardHistory> <ClipboardHistory>
<PanelTitle name="Clipboard History"/> <PanelTitle name="Clipboard History"/>

View File

@ -1247,6 +1247,8 @@ Continue?"/>
<ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/> <!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. --> <ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/> <!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
<WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/> <WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/>
<LanguageMenuCompactWarning title="Compact Language Menu" message="This option will be changed on the next launch."/> <!-- HowToReproduce: toggle "Make language menu compact" via Preferences dialog "Language/Language Menu. --> <LanguageMenuCompactWarning title="Compact Language Menu" message="This option will be changed on the next launch."/> <!-- HowToReproduce: toggle "Make language menu compact" via Preferences dialog "Language/Language Menu. -->
<SwitchUnsavedThemeWarning title="$STR_REPLACE$" message="Unsaved changes are about to be discarded!
Do you want to save your changes before switching themes?"/> <!-- HowToReproduce: In the Style Configurator dialog change some theme and switch to other theme without saving. -->
</MessageBox> </MessageBox>
<ClipboardHistory> <ClipboardHistory>
<PanelTitle name="Clipboard History"/> <PanelTitle name="Clipboard History"/>

View File

@ -21,6 +21,7 @@
#include "documentMap.h" #include "documentMap.h"
#include "AutoCompletion.h" #include "AutoCompletion.h"
#include "preference_rc.h" #include "preference_rc.h"
#include "localization.h"
using namespace std; using namespace std;
@ -798,12 +799,14 @@ void WordStyleDlg::switchToTheme()
wcscpy_s(themeFileName, prevThemeName.c_str()); wcscpy_s(themeFileName, prevThemeName.c_str());
PathStripPath(themeFileName); PathStripPath(themeFileName);
PathRemoveExtension(themeFileName); PathRemoveExtension(themeFileName);
int mb_response = NativeLangSpeaker *pNativeSpeaker = nppParamInst.getNativeLangSpeaker();
::MessageBox( _hSelf, int mb_response = pNativeSpeaker->messageBox("SwitchUnsavedThemeWarning",
TEXT(" Unsaved changes are about to be discarded!\n") _hSelf,
TEXT(" Do you want to save your changes before switching themes?"), TEXT("Unsaved changes are about to be discarded!\nDo you want to save your changes before switching themes?"),
themeFileName, TEXT("$STR_REPLACE$"),
MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND ); MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND,
0,
themeFileName);
if ( mb_response == IDYES ) if ( mb_response == IDYES )
(NppParameters::getInstance()).writeStyles(_lsArray, _globalStyles); (NppParameters::getInstance()).writeStyles(_lsArray, _globalStyles);
} }