Add localization for a theme loading error message

This commit is contained in:
Caeden Statia 2020-02-23 15:37:20 -08:00
parent 5b0b1ad606
commit 225a1f2b91
3 changed files with 15 additions and 5 deletions

View file

@ -255,10 +255,17 @@ namespace ModAssistant
if (isXaml)
{
Uri resourceSource = new Uri(info.FullName);
ResourceDictionary dictionary = new ResourceDictionary();
dictionary.Source = resourceSource;
theme.ThemeDictionary = dictionary;
try
{
Uri resourceSource = new Uri(info.FullName);
ResourceDictionary dictionary = new ResourceDictionary();
dictionary.Source = resourceSource;
theme.ThemeDictionary = dictionary;
}catch(Exception ex)
{
string message = string.Format((string)Application.Current.FindResource("Themes:FailedToLoadXaml"), name, ex.Message);
MessageBox.Show(message);
}
}
if (supportedVideoExtensions.Contains(info.Extension))
@ -371,7 +378,8 @@ namespace ModAssistant
}
catch (Exception ex)
{
MessageBox.Show($"Could not load {name}.\n\n{ex.Message}\n\nIgnoring...");
string message = string.Format((string)Application.Current.FindResource("Themes:FailedToLoadXaml"), name, ex.Message);
MessageBox.Show(message);
}
}
}

View file

@ -149,6 +149,7 @@
<sys:String x:Key="Themes:ThemeMissing">{0} Themes:ThemeMissing</sys:String>
<sys:String x:Key="Themes:SavedTemplateTheme">Themes:SavedTemplateTheme {0}</sys:String>
<sys:String x:Key="Themes:TemplateThemeExists">Themes:TemplateThemeExists</sys:String>
<sys:String x:Key="Themes:FailedToLoadXaml">Themes:FailedToLoadXaml {0} {1}</sys:String>
<!-- Updater Class -->
<sys:String x:Key="Updater:CheckFailed">Updater:CheckFailed</sys:String>

View file

@ -208,6 +208,7 @@
<sys:String x:Key="Themes:ThemeMissing">{0} does not exist.</sys:String>
<sys:String x:Key="Themes:SavedTemplateTheme">Template theme "{0}" saved to Themes folder.</sys:String>
<sys:String x:Key="Themes:TemplateThemeExists">Template theme already exists!</sys:String>
<sys:String x:Key="Themes:FailedToLoadXaml">Failed to load .xaml file for theme {0}: {1}</sys:String>
<!-- Updater Class -->
<sys:String x:Key="Updater:CheckFailed">Couldn't check for updates.</sys:String>