1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 00:03:08 +08:00

Localise wiki overlay error strings

This commit is contained in:
CloneWith 2025-01-01 23:32:04 +08:00
parent fa0d2f4af2
commit 43b9e537bf
No known key found for this signature in database
GPG Key ID: F4FC0D1E91D7FFD5
2 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,30 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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";
/// <summary>
/// "Something went wrong when trying to fetch page "{0}"."
/// </summary>
public static LocalisableString PageErrorDescription(string path) =>
new TranslatableString(getKey(@"page_error_description"), @"Something went wrong when trying to fetch page ""{0}"".", path);
/// <summary>
/// "[Reload this page]({0})."
/// </summary>
public static LocalisableString ReloadPageLink(string url) => new TranslatableString(getKey(@"reload_page_link"), @"[Reload this page]({0}).", url);
/// <summary>
/// "[Return to the main page]({0})."
/// </summary>
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}";
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays
private readonly Bindable<string> path = new Bindable<string>(INDEX_PATH);
private readonly Bindable<APIWikiPage?> wikiData = new Bindable<APIWikiPage?>();
private readonly IBindable<Language> language = new Bindable<Language>();
private readonly Bindable<Language> language = new Bindable<Language>();
[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()