From 43b9e537bf0d19bb680f9a8b392ae823d067e906 Mon Sep 17 00:00:00 2001 From: CloneWith Date: Wed, 1 Jan 2025 23:32:04 +0800 Subject: [PATCH] Localise wiki overlay error strings --- osu.Game/Localisation/WikiOverlayStrings.cs | 30 +++++++++++++++++++++ osu.Game/Overlays/WikiOverlay.cs | 5 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 osu.Game/Localisation/WikiOverlayStrings.cs diff --git a/osu.Game/Localisation/WikiOverlayStrings.cs b/osu.Game/Localisation/WikiOverlayStrings.cs new file mode 100644 index 0000000000..e6f0ed92e4 --- /dev/null +++ b/osu.Game/Localisation/WikiOverlayStrings.cs @@ -0,0 +1,30 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public class WikiOverlayStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.WikiOverlayStrings"; + + /// + /// "Something went wrong when trying to fetch page "{0}"." + /// + public static LocalisableString PageErrorDescription(string path) => + new TranslatableString(getKey(@"page_error_description"), @"Something went wrong when trying to fetch page ""{0}"".", path); + + /// + /// "[Reload this page]({0})." + /// + public static LocalisableString ReloadPageLink(string url) => new TranslatableString(getKey(@"reload_page_link"), @"[Reload this page]({0}).", url); + + /// + /// "[Return to the main page]({0})." + /// + public static LocalisableString ReturnToMainPageLink(string url) => new TranslatableString(getKey(@"return_to_main_page_link"), @"[Return to the main page]({0}).", url); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} diff --git a/osu.Game/Overlays/WikiOverlay.cs b/osu.Game/Overlays/WikiOverlay.cs index 14a25a909d..5149792bbb 100644 --- a/osu.Game/Overlays/WikiOverlay.cs +++ b/osu.Game/Overlays/WikiOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays private readonly Bindable path = new Bindable(INDEX_PATH); private readonly Bindable wikiData = new Bindable(); - private readonly IBindable language = new Bindable(); + private readonly Bindable language = new Bindable(); [Resolved] private IAPIProvider api { get; set; } = null!; @@ -177,7 +177,8 @@ namespace osu.Game.Overlays path.Value = "error"; LoadDisplay(articlePage = new WikiArticlePage($@"{api.WebsiteRootUrl}/wiki/", - $"Something went wrong when trying to fetch page \"{originalPath}\".\n\n[Return to the main page]({INDEX_PATH}).")); + $"{WikiOverlayStrings.PageErrorDescription(originalPath)}\n\n" + + $"{WikiOverlayStrings.ReloadPageLink(originalPath)}\n{WikiOverlayStrings.ReturnToMainPageLink(INDEX_PATH)}")); } private void showParentPage()