Skip to content

Commit

Permalink
Localize message boxes (#291)
Browse files Browse the repository at this point in the history
* Localize message boxes

* - adjust localization

* Localize remaining messages

* - adjust german localization to existing localizations

Co-authored-by: FroggieFrog <[email protected]>
  • Loading branch information
AgmasGold and FroggieFrog authored Sep 15, 2020
1 parent 8a7d72a commit 92efb22
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 23 deletions.
12 changes: 7 additions & 5 deletions AnnoDesigner/AnnoCanvas.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ public AnnoCanvas(BuildingPresets presetsToUse,
}
catch (Exception ex)
{
_messageBoxService.ShowError(ex.Message, "Loading of the building presets failed");
_messageBoxService.ShowError(ex.Message,
_localizationHelper.GetLocalization("LoadingPresetsFailed"));
}

sw.Stop();
Expand All @@ -695,7 +696,7 @@ public AnnoCanvas(BuildingPresets presetsToUse,
{
logger.Error(ex, "Loading of the icon names failed.");

_messageBoxService.ShowError("Loading of the icon names failed",
_messageBoxService.ShowError(_localizationHelper.GetLocalization("LoadingIconNamesFailed"),
_localizationHelper.GetLocalization("Error"));
}

Expand Down Expand Up @@ -2393,8 +2394,9 @@ public void OpenFile(string filename, bool forceLoad = false)
{
logger.Warn(layoutEx, "Version of layout file is not supported.");

if (_messageBoxService.ShowQuestion("Try loading anyway?\nThis is very likely to fail or result in strange things happening.",
"File version unsupported"))
if (_messageBoxService.ShowQuestion(
_localizationHelper.GetLocalization("FileVersionUnsupportedMessage"),
_localizationHelper.GetLocalization("FileVersionUnsupportedTitle")))
{
OpenFile(filename, true);
}
Expand All @@ -2413,7 +2415,7 @@ public void OpenFile(string filename, bool forceLoad = false)
/// <param name="e">exception containing error information</param>
private void IOErrorMessageBox(Exception e)
{
_messageBoxService.ShowError(e.Message, "Something went wrong while saving/loading file.");
_messageBoxService.ShowError(e.Message, _localizationHelper.GetLocalization("IOErrorMessage"));
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions AnnoDesigner/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private async void Application_Startup(object sender, StartupEventArgs e)

if (!createdNewMutex)
{
_messageBoxService.ShowMessage("Another instance of the app is already running.");
_messageBoxService.ShowMessage(Localization.Localization.Instance.GetLocalization("AnotherInstanceIsAlreadyRunning"));
Environment.Exit(-1);
}
}
Expand All @@ -177,7 +177,7 @@ private async void Application_Startup(object sender, StartupEventArgs e)
{
logger.Error(ex, "Error upgrading settings.");

_messageBoxService.ShowError("The settings file has become corrupted. We must reset your settings.");
_messageBoxService.ShowError(_localizationHelper.GetLocalization("ErrorUpgradingSettings"));

var fileName = "";
if (!string.IsNullOrEmpty(ex.Filename))
Expand Down
Loading

0 comments on commit 92efb22

Please sign in to comment.