/// <summary> /// Change the language of MemPlus /// </summary> internal void LoadLanguage() { GuiManager.ChangeLanguage(_logController); try { _updateManager?.SetStringVariables(LoadUpdateManagerStrings()); TbiIcon?.InvalidateVisual(); } catch (Exception ex) { MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error); _logController.AddLog(new ApplicationLog(ex.Message)); } }
/// <summary> /// Change the language of MemPlus /// </summary> internal void LoadLanguage() { _logController.AddLog(new ApplicationLog("Changing language")); ResourceDictionary dict = new ResourceDictionary(); Uri langUri = new Uri("..\\Resources\\Languages\\en_US.xaml", UriKind.Relative); try { switch (Properties.Settings.Default.SelectedLanguage) { case 1: langUri = new Uri("..\\Resources\\Languages\\nl_BE.xaml", UriKind.Relative); break; case 2: langUri = new Uri("..\\Resources\\Languages\\es_ES.xaml", UriKind.Relative); break; case 3: langUri = new Uri("..\\Resources\\Languages\\gl_ES.xaml", UriKind.Relative); break; } } catch (Exception ex) { langUri = new Uri("..\\Resources\\Languages\\en.xaml", UriKind.Relative); _logController.AddLog(new ApplicationLog(ex.Message)); MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error); } dict.Source = langUri; Application.Current.Resources.MergedDictionaries.Clear(); Application.Current.Resources.MergedDictionaries.Add(dict); _updateManager?.SetStringVariables(LoadUpdateManagerStrings()); TbiIcon?.InvalidateVisual(); _logController.AddLog(new ApplicationLog("Done changing language")); }