mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ fix: set preferred language to internal, in case of "don't show again" option on not avail confirmation dialog is enabled
This commit is contained in:
parent
5bc0a3a4aa
commit
37349a0f71
@ -1974,8 +1974,8 @@ static bool _SaveSettings(bool bForceSaveSettings)
|
||||
switch (Globals.idxSelectedTheme) {
|
||||
case 1:
|
||||
Style_ToIniSection(Globals.bIniFileFromScratch, true); // Scintilla Styles
|
||||
// fall trough
|
||||
case 0:
|
||||
//~break;
|
||||
case 0: // fall trough
|
||||
IniSectionDelete(IniSecStyles, Constants.StylingThemeName, false);
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -260,16 +260,18 @@ bool GetUserPreferredLanguage(LPWSTR pszPrefLocaleName, int cchBuffer, LANGID* p
|
||||
//
|
||||
static void SetMuiLocaleAll(LPCWSTR pszLocaleStr)
|
||||
{
|
||||
const WCHAR* const pszLocaleCur = _wsetlocale(LC_ALL, pszLocaleStr);
|
||||
if (StringCchCompareXI(pszLocaleStr, pszLocaleCur) != 0) {
|
||||
//const _locale_t pCurLocale = _get_current_locale();
|
||||
_wsetlocale(LC_ALL, L""); // system standard
|
||||
if (pszLocaleStr) {
|
||||
const WCHAR* const pszLocaleCur = _wsetlocale(LC_ALL, pszLocaleStr);
|
||||
if (pszLocaleCur && (StringCchCompareXI(pszLocaleStr, pszLocaleCur) != 0)) {
|
||||
//const _locale_t pCurLocale = _get_current_locale();
|
||||
_wsetlocale(LC_ALL, L""); // system standard
|
||||
#ifdef _DEBUG
|
||||
WCHAR msg[128];
|
||||
StringCchPrintf(msg, COUNTOF(msg), L"Can't set desired locale '%s', using '%s' instead!",
|
||||
pszLocaleStr, pszLocaleCur ? pszLocaleCur : L"<default>");
|
||||
MsgBoxLastError(msg, ERROR_MUI_INVALID_LOCALE_NAME);
|
||||
WCHAR msg[128];
|
||||
StringCchPrintf(msg, COUNTOF(msg), L"Can't set desired locale '%s', using '%s' instead!",
|
||||
pszLocaleStr, pszLocaleCur ? pszLocaleCur : L"<default>");
|
||||
MsgBoxLastError(msg, ERROR_MUI_INVALID_LOCALE_NAME);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,19 +346,19 @@ LANGID LoadLanguageResources()
|
||||
WCHAR tchUserLangMultiStrg[LARGE_BUFFER] = { L'\0' };
|
||||
if (!_LngStrToMultiLngStr(tchAvailLngs, tchUserLangMultiStrg, COUNTOF(tchUserLangMultiStrg)))
|
||||
{
|
||||
MsgBoxLastError(L"Trying to load Language resource!", ERROR_MUI_INVALID_LOCALE_NAME);
|
||||
MsgBoxLastError(L"Trying to load available Language resources!", ERROR_MUI_INVALID_LOCALE_NAME);
|
||||
}
|
||||
ULONG langCount = 0;
|
||||
// using SetProcessPreferredUILanguages is recommended for new applications (esp. multi-threaded applications)
|
||||
SetProcessPreferredUILanguages(0, L"\0\0", &langCount); // clear
|
||||
if (!SetProcessPreferredUILanguages(MUI_LANGUAGE_NAME, tchUserLangMultiStrg, &langCount) || (langCount == 0))
|
||||
{
|
||||
MsgBoxLastError(L"Trying to set preferred Language!", ERROR_RESOURCE_LANG_NOT_FOUND);
|
||||
DbgMsgBoxLastError(L"Trying to set preferred Language!", ERROR_RESOURCE_LANG_NOT_FOUND);
|
||||
}
|
||||
//else {
|
||||
// SetThreadPreferredUILanguages(0, L"\0\0", &langCount); // clear
|
||||
// SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, tchUserLangMultiStrg, &langCount);
|
||||
//}
|
||||
//~else {
|
||||
//~ SetThreadPreferredUILanguages(0, L"\0\0", &langCount); // clear
|
||||
//~ SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, tchUserLangMultiStrg, &langCount);
|
||||
//~}
|
||||
|
||||
// obtains access to the proper resource container
|
||||
// for standard Win32 resource loading this is normally a PE module - use LoadLibraryEx
|
||||
|
||||
@ -982,7 +982,12 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, (TIMERPROC)MQ_ExecuteNext);
|
||||
|
||||
if (Globals.bPrefLngNotAvail) {
|
||||
InfoBoxLng(MB_ICONWARNING, L"MsgPrefLanguageNotAvailable", IDS_WARN_PREF_LNG_NOT_AVAIL, Settings2.PreferredLanguageLocaleName);
|
||||
const WCHAR* const suprMsg = L"MsgPrefLanguageNotAvailable";
|
||||
InfoBoxLng(MB_ICONWARNING, suprMsg, IDS_WARN_PREF_LNG_NOT_AVAIL, Settings2.PreferredLanguageLocaleName);
|
||||
int const noMsg = IniFileGetInt(Globals.IniFile, Constants.SectionSuppressedMessages, suprMsg, 0);
|
||||
if (noMsg && Globals.bCanSaveIniFile) {
|
||||
IniFileSetString(Globals.IniFile, Constants.Settings2_Section, L"PreferredLanguageLocaleName", MUI_LanguageDLLs[0].szLocaleName);
|
||||
}
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user