1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 19:53:23 +08:00

Replace string locale with Language

This commit is contained in:
Riley Quinn 2022-03-04 00:57:13 -06:00
parent 81a49057ec
commit 8491bab77c
No known key found for this signature in database
GPG Key ID: C51D68464AD87CE4
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Game.Extensions;
using osu.Game.Localisation;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
@ -8,14 +10,14 @@ namespace osu.Game.Online.API.Requests
public class GetWikiRequest : APIRequest<APIWikiPage> public class GetWikiRequest : APIRequest<APIWikiPage>
{ {
private readonly string path; private readonly string path;
private readonly string locale; private readonly Language language;
public GetWikiRequest(string path, string locale = "en") public GetWikiRequest(string path, Language language = Language.en)
{ {
this.path = path; this.path = path;
this.locale = locale; this.language = language;
} }
protected override string Target => $"wiki/{locale}/{path}"; protected override string Target => $"wiki/{language.ToCultureCode()}/{path}";
} }
} }

View File

@ -103,9 +103,9 @@ namespace osu.Game.Overlays
string[] values = e.NewValue.Split('/', 2); string[] values = e.NewValue.Split('/', 2);
if (values.Length > 1 && LanguageExtensions.TryParseCultureCode(values[0], out _)) if (values.Length > 1 && LanguageExtensions.TryParseCultureCode(values[0], out var language))
{ {
request = new GetWikiRequest(values[1], values[0]); request = new GetWikiRequest(values[1], language);
} }
else else
{ {