1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Merge pull request #19693 from its5Q/editor-localisation

Add localisation support for beatmap editor setup
This commit is contained in:
Dean Herbert 2022-08-20 11:51:57 +09:00 committed by GitHub
commit cbdd870ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 256 additions and 42 deletions

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -26,9 +27,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
{
public BindableList<Colour4> Colours { get; } = new BindableList<Colour4>();
private string colourNamePrefix = "Colour";
private LocalisableString colourNamePrefix = "Colour";
public string ColourNamePrefix
public LocalisableString ColourNamePrefix
{
get => colourNamePrefix;
set

View File

@ -5,6 +5,7 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
namespace osu.Game.Graphics.UserInterfaceV2
{
@ -17,7 +18,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
public BindableList<Colour4> Colours => Component.Colours;
public string ColourNamePrefix
public LocalisableString ColourNamePrefix
{
get => Component.ColourNamePrefix;
set => Component.ColourNamePrefix = value;

View File

@ -0,0 +1,204 @@
// 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 static class EditorSetupStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.EditorSetup";
/// <summary>
/// "Beatmap Setup"
/// </summary>
public static LocalisableString BeatmapSetup => new TranslatableString(getKey(@"beatmap_setup"), @"Beatmap Setup");
/// <summary>
/// "change general settings of your beatmap"
/// </summary>
public static LocalisableString BeatmapSetupDescription => new TranslatableString(getKey(@"beatmap_setup_description"), @"change general settings of your beatmap");
/// <summary>
/// "Colours"
/// </summary>
public static LocalisableString ColoursHeader => new TranslatableString(getKey(@"colours_header"), @"Colours");
/// <summary>
/// "Hit circle / Slider Combos"
/// </summary>
public static LocalisableString HitCircleSliderCombos => new TranslatableString(getKey(@"hit_circle_slider_combos"), @"Hit circle / Slider Combos");
/// <summary>
/// "Design"
/// </summary>
public static LocalisableString DesignHeader => new TranslatableString(getKey(@"design_header"), @"Design");
/// <summary>
/// "Enable countdown"
/// </summary>
public static LocalisableString EnableCountdown => new TranslatableString(getKey(@"enable_countdown"), @"Enable countdown");
/// <summary>
/// "If enabled, an &quot;Are you ready? 3, 2, 1, GO!&quot; countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so."
/// </summary>
public static LocalisableString CountdownDescription => new TranslatableString(getKey(@"countdown_description"), @"If enabled, an ""Are you ready? 3, 2, 1, GO!"" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so.");
/// <summary>
/// "Countdown speed"
/// </summary>
public static LocalisableString CountdownSpeed => new TranslatableString(getKey(@"countdown_speed"), @"Countdown speed");
/// <summary>
/// "If the countdown sounds off-time, use this to make it appear one or more beats early."
/// </summary>
public static LocalisableString CountdownOffsetDescription => new TranslatableString(getKey(@"countdown_offset_description"), @"If the countdown sounds off-time, use this to make it appear one or more beats early.");
/// <summary>
/// "Countdown offset"
/// </summary>
public static LocalisableString CountdownOffset => new TranslatableString(getKey(@"countdown_offset"), @"Countdown offset");
/// <summary>
/// "Widescreen support"
/// </summary>
public static LocalisableString WidescreenSupport => new TranslatableString(getKey(@"widescreen_support"), @"Widescreen support");
/// <summary>
/// "Allows storyboards to use the full screen space, rather than be confined to a 4:3 area."
/// </summary>
public static LocalisableString WidescreenSupportDescription => new TranslatableString(getKey(@"widescreen_support_description"), @"Allows storyboards to use the full screen space, rather than be confined to a 4:3 area.");
/// <summary>
/// "Epilepsy warning"
/// </summary>
public static LocalisableString EpilepsyWarning => new TranslatableString(getKey(@"epilepsy_warning"), @"Epilepsy warning");
/// <summary>
/// "Recommended if the storyboard or video contain scenes with rapidly flashing colours."
/// </summary>
public static LocalisableString EpilepsyWarningDescription => new TranslatableString(getKey(@"epilepsy_warning_description"), @"Recommended if the storyboard or video contain scenes with rapidly flashing colours.");
/// <summary>
/// "Letterbox during breaks"
/// </summary>
public static LocalisableString LetterboxDuringBreaks => new TranslatableString(getKey(@"letterbox_during_breaks"), @"Letterbox during breaks");
/// <summary>
/// "Adds horizontal letterboxing to give a cinematic look during breaks."
/// </summary>
public static LocalisableString LetterboxDuringBreaksDescription => new TranslatableString(getKey(@"letterbox_during_breaks_description"), @"Adds horizontal letterboxing to give a cinematic look during breaks.");
/// <summary>
/// "Samples match playback rate"
/// </summary>
public static LocalisableString SamplesMatchPlaybackRate => new TranslatableString(getKey(@"samples_match_playback_rate"), @"Samples match playback rate");
/// <summary>
/// "When enabled, all samples will speed up or slow down when rate-changing mods are enabled."
/// </summary>
public static LocalisableString SamplesMatchPlaybackRateDescription => new TranslatableString(getKey(@"samples_match_playback_rate_description"), @"When enabled, all samples will speed up or slow down when rate-changing mods are enabled.");
/// <summary>
/// "The size of all hit objects"
/// </summary>
public static LocalisableString CircleSizeDescription => new TranslatableString(getKey(@"circle_size_description"), @"The size of all hit objects");
/// <summary>
/// "The rate of passive health drain throughout playable time"
/// </summary>
public static LocalisableString DrainRateDescription => new TranslatableString(getKey(@"drain_rate_description"), @"The rate of passive health drain throughout playable time");
/// <summary>
/// "The speed at which objects are presented to the player"
/// </summary>
public static LocalisableString ApproachRateDescription => new TranslatableString(getKey(@"approach_rate_description"), @"The speed at which objects are presented to the player");
/// <summary>
/// "The harshness of hit windows and difficulty of special objects (ie. spinners)"
/// </summary>
public static LocalisableString OverallDifficultyDescription => new TranslatableString(getKey(@"overall_difficulty_description"), @"The harshness of hit windows and difficulty of special objects (ie. spinners)");
/// <summary>
/// "Metadata"
/// </summary>
public static LocalisableString MetadataHeader => new TranslatableString(getKey(@"metadata_header"), @"Metadata");
/// <summary>
/// "Romanised Artist"
/// </summary>
public static LocalisableString RomanisedArtist => new TranslatableString(getKey(@"romanised_artist"), @"Romanised Artist");
/// <summary>
/// "Romanised Title"
/// </summary>
public static LocalisableString RomanisedTitle => new TranslatableString(getKey(@"romanised_title"), @"Romanised Title");
/// <summary>
/// "Creator"
/// </summary>
public static LocalisableString Creator => new TranslatableString(getKey(@"creator"), @"Creator");
/// <summary>
/// "Difficulty Name"
/// </summary>
public static LocalisableString DifficultyName => new TranslatableString(getKey(@"difficulty_name"), @"Difficulty Name");
/// <summary>
/// "Resources"
/// </summary>
public static LocalisableString ResourcesHeader => new TranslatableString(getKey(@"resources_header"), @"Resources");
/// <summary>
/// "Audio Track"
/// </summary>
public static LocalisableString AudioTrack => new TranslatableString(getKey(@"audio_track"), @"Audio Track");
/// <summary>
/// "Click to select a track"
/// </summary>
public static LocalisableString ClickToSelectTrack => new TranslatableString(getKey(@"click_to_select_track"), @"Click to select a track");
/// <summary>
/// "Click to replace the track"
/// </summary>
public static LocalisableString ClickToReplaceTrack => new TranslatableString(getKey(@"click_to_replace_track"), @"Click to replace the track");
/// <summary>
/// "Click to select a background image"
/// </summary>
public static LocalisableString ClickToSelectBackground => new TranslatableString(getKey(@"click_to_select_background"), @"Click to select a background image");
/// <summary>
/// "Click to replace the background image"
/// </summary>
public static LocalisableString ClickToReplaceBackground => new TranslatableString(getKey(@"click_to_replace_background"), @"Click to replace the background image");
/// <summary>
/// "Ruleset ({0})"
/// </summary>
public static LocalisableString RulesetHeader(string arg0) => new TranslatableString(getKey(@"ruleset"), @"Ruleset ({0})", arg0);
/// <summary>
/// "Combo"
/// </summary>
public static LocalisableString ComboColourPrefix => new TranslatableString(getKey(@"combo_colour_prefix"), @"Combo");
/// <summary>
/// "Artist"
/// </summary>
public static LocalisableString Artist => new TranslatableString(getKey(@"artist"), @"Artist");
/// <summary>
/// "Title"
/// </summary>
public static LocalisableString Title => new TranslatableString(getKey(@"title"), @"Title");
/// <summary>
/// "Difficulty"
/// </summary>
public static LocalisableString DifficultyHeader => new TranslatableString(getKey(@"difficulty_header"), @"Difficulty");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -7,12 +7,13 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
internal class ColoursSection : SetupSection
{
public override LocalisableString Title => "Colours";
public override LocalisableString Title => EditorSetupStrings.ColoursHeader;
private LabelledColourPalette comboColours;
@ -23,9 +24,9 @@ namespace osu.Game.Screens.Edit.Setup
{
comboColours = new LabelledColourPalette
{
Label = "Hitcircle / Slider Combos",
Label = EditorSetupStrings.HitCircleSliderCombos,
FixedLabelWidth = LABEL_WIDTH,
ColourNamePrefix = "Combo"
ColourNamePrefix = EditorSetupStrings.ComboColourPrefix
}
};

View File

@ -13,6 +13,7 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2;
using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
@ -29,7 +30,7 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledSwitchButton letterboxDuringBreaks;
private LabelledSwitchButton samplesMatchPlaybackRate;
public override LocalisableString Title => "Design";
public override LocalisableString Title => EditorSetupStrings.DesignHeader;
[BackgroundDependencyLoader]
private void load()
@ -38,9 +39,9 @@ namespace osu.Game.Screens.Edit.Setup
{
EnableCountdown = new LabelledSwitchButton
{
Label = "Enable countdown",
Label = EditorSetupStrings.EnableCountdown,
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None },
Description = "If enabled, an \"Are you ready? 3, 2, 1, GO!\" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so."
Description = EditorSetupStrings.CountdownDescription
},
CountdownSettings = new FillFlowContainer
{
@ -52,41 +53,41 @@ namespace osu.Game.Screens.Edit.Setup
{
CountdownSpeed = new LabelledEnumDropdown<CountdownType>
{
Label = "Countdown speed",
Label = EditorSetupStrings.CountdownSpeed,
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None ? Beatmap.BeatmapInfo.Countdown : CountdownType.Normal },
Items = Enum.GetValues(typeof(CountdownType)).Cast<CountdownType>().Where(type => type != CountdownType.None)
},
CountdownOffset = new LabelledNumberBox
{
Label = "Countdown offset",
Label = EditorSetupStrings.CountdownOffset,
Current = { Value = Beatmap.BeatmapInfo.CountdownOffset.ToString() },
Description = "If the countdown sounds off-time, use this to make it appear one or more beats early.",
Description = EditorSetupStrings.CountdownOffsetDescription,
}
}
},
Empty(),
widescreenSupport = new LabelledSwitchButton
{
Label = "Widescreen support",
Description = "Allows storyboards to use the full screen space, rather than be confined to a 4:3 area.",
Label = EditorSetupStrings.WidescreenSupport,
Description = EditorSetupStrings.WidescreenSupportDescription,
Current = { Value = Beatmap.BeatmapInfo.WidescreenStoryboard }
},
epilepsyWarning = new LabelledSwitchButton
{
Label = "Epilepsy warning",
Description = "Recommended if the storyboard or video contain scenes with rapidly flashing colours.",
Label = EditorSetupStrings.EpilepsyWarning,
Description = EditorSetupStrings.EpilepsyWarningDescription,
Current = { Value = Beatmap.BeatmapInfo.EpilepsyWarning }
},
letterboxDuringBreaks = new LabelledSwitchButton
{
Label = "Letterbox during breaks",
Description = "Adds horizontal letterboxing to give a cinematic look during breaks.",
Label = EditorSetupStrings.LetterboxDuringBreaks,
Description = EditorSetupStrings.LetterboxDuringBreaksDescription,
Current = { Value = Beatmap.BeatmapInfo.LetterboxInBreaks }
},
samplesMatchPlaybackRate = new LabelledSwitchButton
{
Label = "Samples match playback rate",
Description = "When enabled, all samples will speed up or slow down when rate-changing mods are enabled.",
Label = EditorSetupStrings.SamplesMatchPlaybackRate,
Description = EditorSetupStrings.SamplesMatchPlaybackRateDescription,
Current = { Value = Beatmap.BeatmapInfo.SamplesMatchPlaybackRate }
}
};

View File

@ -11,6 +11,7 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
@ -21,7 +22,7 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledSliderBar<float> approachRateSlider;
private LabelledSliderBar<float> overallDifficultySlider;
public override LocalisableString Title => "Difficulty";
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
[BackgroundDependencyLoader]
private void load()
@ -32,7 +33,7 @@ namespace osu.Game.Screens.Edit.Setup
{
Label = BeatmapsetsStrings.ShowStatsCs,
FixedLabelWidth = LABEL_WIDTH,
Description = "The size of all hit objects",
Description = EditorSetupStrings.CircleSizeDescription,
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
{
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
@ -45,7 +46,7 @@ namespace osu.Game.Screens.Edit.Setup
{
Label = BeatmapsetsStrings.ShowStatsDrain,
FixedLabelWidth = LABEL_WIDTH,
Description = "The rate of passive health drain throughout playable time",
Description = EditorSetupStrings.DrainRateDescription,
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
{
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
@ -58,7 +59,7 @@ namespace osu.Game.Screens.Edit.Setup
{
Label = BeatmapsetsStrings.ShowStatsAr,
FixedLabelWidth = LABEL_WIDTH,
Description = "The speed at which objects are presented to the player",
Description = EditorSetupStrings.ApproachRateDescription,
Current = new BindableFloat(Beatmap.Difficulty.ApproachRate)
{
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
@ -71,7 +72,7 @@ namespace osu.Game.Screens.Edit.Setup
{
Label = BeatmapsetsStrings.ShowStatsAccuracy,
FixedLabelWidth = LABEL_WIDTH,
Description = "The harshness of hit windows and difficulty of special objects (ie. spinners)",
Description = EditorSetupStrings.OverallDifficultyDescription,
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
{
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,

View File

@ -10,6 +10,7 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledTextBox sourceTextBox;
private LabelledTextBox tagsTextBox;
public override LocalisableString Title => "Metadata";
public override LocalisableString Title => EditorSetupStrings.MetadataHeader;
[BackgroundDependencyLoader]
private void load()
@ -35,22 +36,22 @@ namespace osu.Game.Screens.Edit.Setup
Children = new[]
{
ArtistTextBox = createTextBox<LabelledTextBox>("Artist",
ArtistTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.Artist,
!string.IsNullOrEmpty(metadata.ArtistUnicode) ? metadata.ArtistUnicode : metadata.Artist),
RomanisedArtistTextBox = createTextBox<LabelledRomanisedTextBox>("Romanised Artist",
RomanisedArtistTextBox = createTextBox<LabelledRomanisedTextBox>(EditorSetupStrings.RomanisedArtist,
!string.IsNullOrEmpty(metadata.Artist) ? metadata.Artist : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),
Empty(),
TitleTextBox = createTextBox<LabelledTextBox>("Title",
TitleTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.Title,
!string.IsNullOrEmpty(metadata.TitleUnicode) ? metadata.TitleUnicode : metadata.Title),
RomanisedTitleTextBox = createTextBox<LabelledRomanisedTextBox>("Romanised Title",
RomanisedTitleTextBox = createTextBox<LabelledRomanisedTextBox>(EditorSetupStrings.RomanisedTitle,
!string.IsNullOrEmpty(metadata.Title) ? metadata.Title : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),
Empty(),
creatorTextBox = createTextBox<LabelledTextBox>("Creator", metadata.Author.Username),
difficultyTextBox = createTextBox<LabelledTextBox>("Difficulty Name", Beatmap.BeatmapInfo.DifficultyName),
creatorTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.Creator, metadata.Author.Username),
difficultyTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.DifficultyName, Beatmap.BeatmapInfo.DifficultyName),
sourceTextBox = createTextBox<LabelledTextBox>(BeatmapsetsStrings.ShowInfoSource, metadata.Source),
tagsTextBox = createTextBox<LabelledTextBox>(BeatmapsetsStrings.ShowInfoTags, metadata.Tags)
};

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
@ -18,7 +19,7 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledFileChooser audioTrackChooser;
private LabelledFileChooser backgroundChooser;
public override LocalisableString Title => "Resources";
public override LocalisableString Title => EditorSetupStrings.ResourcesHeader;
[Resolved]
private MusicController music { get; set; }
@ -42,13 +43,13 @@ namespace osu.Game.Screens.Edit.Setup
{
backgroundChooser = new LabelledFileChooser(".jpg", ".jpeg", ".png")
{
Label = "Background",
Label = GameplaySettingsStrings.BackgroundHeader,
FixedLabelWidth = LABEL_WIDTH,
TabbableContentContainer = this
},
audioTrackChooser = new LabelledFileChooser(".mp3", ".ogg")
{
Label = "Audio Track",
Label = EditorSetupStrings.AudioTrack,
FixedLabelWidth = LABEL_WIDTH,
TabbableContentContainer = this
},
@ -143,12 +144,12 @@ namespace osu.Game.Screens.Edit.Setup
private void updatePlaceholderText()
{
audioTrackChooser.Text = audioTrackChooser.Current.Value == null
? "Click to select a track"
: "Click to replace the track";
? EditorSetupStrings.ClickToSelectTrack
: EditorSetupStrings.ClickToReplaceTrack;
backgroundChooser.Text = backgroundChooser.Current.Value == null
? "Click to select a background image"
: "Click to replace the background image";
? EditorSetupStrings.ClickToSelectBackground
: EditorSetupStrings.ClickToReplaceBackground;
}
}
}

View File

@ -5,12 +5,13 @@
using osu.Framework.Localisation;
using osu.Game.Rulesets;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
public abstract class RulesetSetupSection : SetupSection
{
public sealed override LocalisableString Title => $"Ruleset ({rulesetInfo.Name})";
public sealed override LocalisableString Title => EditorSetupStrings.RulesetHeader(rulesetInfo.Name);
private readonly RulesetInfo rulesetInfo;

View File

@ -4,6 +4,7 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -11,6 +12,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osuTK.Graphics;
using osu.Game.Localisation;
namespace osu.Game.Screens.Edit.Setup
{
@ -77,8 +79,8 @@ namespace osu.Game.Screens.Edit.Setup
{
public SetupScreenTitle()
{
Title = "beatmap setup";
Description = "change general settings of your beatmap";
Title = EditorSetupStrings.BeatmapSetup.ToLower();
Description = EditorSetupStrings.BeatmapSetupDescription;
IconTexture = "Icons/Hexacons/social";
}
}