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
Changes from 1 commit
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
Next Next commit
Add the translation string.
andy840119 committed Jun 5, 2022
commit 19844e972e798cfe7be2baf864a6ca2a10161242
Original file line number Diff line number Diff line change
@@ -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;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Languages
{
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Notes
{
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.RomajiTags
{
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.RubyTags
{
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.TimeTags
{
@@ -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;
}
16 changes: 16 additions & 0 deletions osu.Game.Rulesets.Karaoke/Localisation/LanguageDetectorStrings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation
{
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}";
}
}
21 changes: 21 additions & 0 deletions osu.Game.Rulesets.Karaoke/Localisation/NoteGeneratorStrings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation
{
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
{
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}";
}
}
16 changes: 16 additions & 0 deletions osu.Game.Rulesets.Karaoke/Localisation/RubyTagGeneratorStrings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation
{
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}";
}
}
16 changes: 16 additions & 0 deletions osu.Game.Rulesets.Karaoke/Localisation/TimeTagGeneratorStrings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using osu.Framework.Localisation;

namespace osu.Game.Rulesets.Karaoke.Localisation
{
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}";
}
}