Skip to content

Commit

Permalink
Merge pull request #109 from Razzmatazzz/lang-change-notify
Browse files Browse the repository at this point in the history
Notify the user an app restart may be required on changing language.
  • Loading branch information
Razzmatazzz authored Aug 17, 2023
2 parents 78f34bb + 9531eec commit 9aa1c1e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RemnantSaveGuardian/Views/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<TextBlock Name="lblMissingItemColor" Text="{lex:Loc}" ToolTip="{lex:Loc}" VerticalAlignment="Center" Margin="20,0,0,0"/>
</WrapPanel>
<WrapPanel Margin="0,2,0,0">
<ComboBox Name="cmbSwitchLanguage" VerticalAlignment="Center" Width="Auto" SelectionChanged="cmbSwitchLanguage_SelectionChanged"/>
<ComboBox Name="cmbSwitchLanguage" VerticalAlignment="Center" Width="Auto"/>
<TextBlock Name="lblSwitchLanguage" Text="{lex:Loc}" ToolTip="{lex:Loc}" VerticalAlignment="Center" Margin="20,0,0,0"/>
</WrapPanel>
<WrapPanel Margin="0,2,0,0">
Expand Down
2 changes: 2 additions & 0 deletions RemnantSaveGuardian/Views/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public SettingsPage(ViewModels.SettingsViewModel viewModel)
else
cmbSwitchLanguage.SelectedItem = culture.NativeName;
}
cmbSwitchLanguage.SelectionChanged += cmbSwitchLanguage_SelectionChanged;

radThemeLight.IsChecked = Properties.Settings.Default.Theme == "Light";

Expand Down Expand Up @@ -314,6 +315,7 @@ private void cmbSwitchLanguage_SelectionChanged(object sender, SelectionChangedE
WPFLocalizeExtension.Engine.LocalizeDictionary.Instance.Culture = culture;
Application.Current.MainWindow.Language = System.Windows.Markup.XmlLanguage.GetLanguage(culture.IetfLanguageTag);
Properties.Settings.Default.Language = langs[cmbSwitchLanguage.SelectedIndex].Name;
Logger.Success(Loc.T("Language_change_notice_{chosenLanguage}", new() { { "chosenLanguage", culture.DisplayName } }));
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions RemnantSaveGuardian/locales/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions RemnantSaveGuardian/locales/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,7 @@
<data name="lblSwitchLanguage_Text" xml:space="preserve">
<value>Select language</value>
</data>
<data name="Language_change_notice_{chosenLanguage}" xml:space="preserve">
<value>Language changed to {chosenLanguage}. You may have to restart to app for the change to fully apply.</value>
</data>
</root>

0 comments on commit 9aa1c1e

Please sign in to comment.