mirror of
https://github.com/ppy/osu
synced 2024-12-27 17:32:56 +00:00
Merge pull request #17879 from peppy/localisation-debug-store
Add debug language to help with localisation efforts
This commit is contained in:
commit
825368cccd
30
osu.Game/Localisation/DebugLocalisationStore.cs
Normal file
30
osu.Game/Localisation/DebugLocalisationStore.cs
Normal 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation
|
||||
{
|
||||
public class DebugLocalisationStore : ILocalisationStore
|
||||
{
|
||||
public string Get(string lookup) => $@"[[{lookup.Substring(lookup.LastIndexOf('.') + 1)}]]";
|
||||
|
||||
public Task<string> GetAsync(string lookup, CancellationToken cancellationToken = default) => Task.FromResult(Get(lookup));
|
||||
|
||||
public Stream GetStream(string name) => throw new NotImplementedException();
|
||||
|
||||
public IEnumerable<string> GetAvailableResources() => throw new NotImplementedException();
|
||||
|
||||
public CultureInfo EffectiveCulture { get; } = CultureInfo.CurrentCulture;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -110,6 +110,11 @@ namespace osu.Game.Localisation
|
||||
// zh_hk,
|
||||
|
||||
[Description(@"繁體中文(台灣)")]
|
||||
zh_hant
|
||||
zh_hant,
|
||||
|
||||
#if DEBUG
|
||||
[Description(@"Debug (show raw keys)")]
|
||||
debug
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -628,6 +628,14 @@ namespace osu.Game
|
||||
|
||||
foreach (var language in Enum.GetValues(typeof(Language)).OfType<Language>())
|
||||
{
|
||||
#if DEBUG
|
||||
if (language == Language.debug)
|
||||
{
|
||||
Localisation.AddLanguage(Language.debug.ToString(), new DebugLocalisationStore());
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
string cultureCode = language.ToCultureCode();
|
||||
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user