File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -627,10 +627,15 @@ namespace winrt::CelestiaAppComponent::implementation
627627 // Must be queried before setting
628628 if (!hasCorrectValue)
629629 return ;
630- if (value == 0 )
631- Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride (L" " );
632- else
633- Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride (LocalizationHelper::ToWindowsTag (availableLanguages.GetAt (value - 1 )));
630+ try
631+ {
632+ if (value == 0 )
633+ // Note: Microsoft::Globalization::ApplicationLanguages::PrimaryLanguageOverride does not accept L"" to reset, so we use the Windows::Globalization variant here.
634+ Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride (L" " );
635+ else
636+ Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride (LocalizationHelper::ToWindowsTag (availableLanguages.GetAt (value - 1 )));
637+ }
638+ catch (hresult_error const &) {}
634639 }
635640
636641 hstring LanguageInt32Item::Title ()
Original file line number Diff line number Diff line change @@ -146,7 +146,11 @@ namespace winrt::CelestiaWinUI::implementation
146146 auto overrideLocaleLegacy = appSettings.LanguageOverride ();
147147 if (!overrideLocaleLegacy.empty ())
148148 {
149- Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride (LocalizationHelper::ToWindowsTag (overrideLocaleLegacy));
149+ try
150+ {
151+ Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride (LocalizationHelper::ToWindowsTag (overrideLocaleLegacy));
152+ }
153+ catch (hresult_error const &) {}
150154 appSettings.LanguageOverride (L" " );
151155 appSettings.Save (AppDataHelper::LocalSettings ());
152156
You can’t perform that action at this time.
0 commit comments