Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC]Add the translation string. #1365

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Edit.Generator.Types;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Languages
{
Expand All @@ -31,7 +32,7 @@ public LanguageDetector(LanguageDetectorConfig config)
public LocalisableString? GetInvalidMessage(Lyric lyric)
{
if (string.IsNullOrWhiteSpace(lyric.Text))
return "Lyric should not be empty.";
return LanguageDetectorStrings.LyricShouldNotBeEmpty;

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using osu.Game.Rulesets.Karaoke.Edit.Generator.Types;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Utils;
using osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Notes
{
Expand All @@ -25,10 +26,10 @@ public NoteGenerator(NoteGeneratorConfig config)
var timeTags = lyric.TimeTags;

if (lyric.TimeTags.Count < 2)
return "Sorry, lyric must have at least two time-tags.";
return NoteGeneratorStrings.SorryLyricMustHaveAtLeastTwoTimeTags;

if (timeTags.Any(x => x.Time == null))
return "All time-tag should have the time.";
return NoteGeneratorStrings.AllTimeTagShouldHaveTheTime;

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Edit.Generator.Types;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.RomajiTags
{
Expand All @@ -19,7 +20,7 @@ protected RomajiTagGenerator(T config)
public LocalisableString? GetInvalidMessage(Lyric lyric)
{
if (string.IsNullOrWhiteSpace(lyric.Text))
return "Lyric should not be empty.";
return RomajiTagGeneratorStrings.LyricShouldNotBeEmpty;

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Edit.Generator.Types;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.RubyTags
{
Expand All @@ -19,7 +20,7 @@ protected RubyTagGenerator(T config)
public LocalisableString? GetInvalidMessage(Lyric lyric)
{
if (string.IsNullOrWhiteSpace(lyric.Text))
return "Lyric should not be empty.";
return RubyTagGeneratorStrings.LyricShouldNotBeEmpty;

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Edit.Generator.Types;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.TimeTags
{
Expand All @@ -22,7 +23,7 @@ protected TimeTagGenerator(T config)
public LocalisableString? GetInvalidMessage(Lyric lyric)
{
if (string.IsNullOrEmpty(lyric.Text))
return "Lyric should not be empty.";
return TimeTagGeneratorStrings.LyricShouldNotBeEmpty;

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator
{
public static class LanguageDetectorStrings
{
private const string prefix = @"osu.Game.Rulesets.Karaoke.Localisation.LanguageDetector";

/// <summary>
/// "Lyric should not be empty."
/// </summary>
public static LocalisableString LyricShouldNotBeEmpty => new TranslatableString(getKey(@"lyric_should_not_be_empty"), @"Lyric should not be empty.");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator
{
public static class NoteGeneratorStrings
{
private const string prefix = @"osu.Game.Rulesets.Karaoke.Localisation.NoteGenerator";

/// <summary>
/// "Sorry, lyric must have at least two time-tags."
/// </summary>
public static LocalisableString SorryLyricMustHaveAtLeastTwoTimeTags => new TranslatableString(getKey(@"sorry_lyric_must_have_at_least_two_time_tags"), @"Sorry, lyric must have at least two time-tags.");

/// <summary>
/// "All time-tag should have the time."
/// </summary>
public static LocalisableString AllTimeTagShouldHaveTheTime => new TranslatableString(getKey(@"all_time_tag_should_have_the_time"), @"All time-tag should have the time.");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator
{
public static class RomajiTagGeneratorStrings
{
private const string prefix = @"osu.Game.Rulesets.Karaoke.Localisation.RomajiTagGenerator";

/// <summary>
/// "Lyric should not be empty."
/// </summary>
public static LocalisableString LyricShouldNotBeEmpty => new TranslatableString(getKey(@"lyric_should_not_be_empty"), @"Lyric should not be empty.");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator
{
public static class RubyTagGeneratorStrings
{
private const string prefix = @"osu.Game.Rulesets.Karaoke.Localisation.RubyTagGenerator";

/// <summary>
/// "Lyric should not be empty."
/// </summary>
public static LocalisableString LyricShouldNotBeEmpty => new TranslatableString(getKey(@"lyric_should_not_be_empty"), @"Lyric should not be empty.");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation.Edit.Generator
{
public static class TimeTagGeneratorStrings
{
private const string prefix = @"osu.Game.Rulesets.Karaoke.Localisation.TimeTagGenerator";

/// <summary>
/// "Lyric should not be empty."
/// </summary>
public static LocalisableString LyricShouldNotBeEmpty => new TranslatableString(getKey(@"lyric_should_not_be_empty"), @"Lyric should not be empty.");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}