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

Romaji to romanization in the generator. #2187

Merged
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 @@ -195,10 +195,10 @@ public void TestAutoGenerateTimeTagsWithNonSupportedLyric()

#endregion

#region Time-tag romaji
#region Romanisation

[Test]
public void TestAutoGenerateTimeTagRomaji()
public void TestAutoGenerateRomanisation()
{
PrepareHitObject(() => new Lyric
{
Expand All @@ -207,7 +207,7 @@ public void TestAutoGenerateTimeTagRomaji()
TimeTags = TestCaseTagHelper.ParseTimeTags(new[] { "[0,start]", "[3,end]" }),
});

TriggerHandlerChanged(c => c.AutoGenerate(AutoGenerateType.AutoGenerateTimeTagRomaji));
TriggerHandlerChanged(c => c.AutoGenerate(AutoGenerateType.AutoGenerateRomanisation));

AssertSelectedHitObject(h =>
{
Expand All @@ -216,7 +216,7 @@ public void TestAutoGenerateTimeTagRomaji()
}

[Test]
public void TestAutoGenerateTimeTagRomajiWithNonSupportedLyric()
public void TestAutoGenerateRomanisationWithNonSupportedLyric()
{
PrepareHitObjects(() => new[]
{
Expand All @@ -228,7 +228,7 @@ public void TestAutoGenerateTimeTagRomajiWithNonSupportedLyric()
},
});

TriggerHandlerChangedWithException<GeneratorNotSupportedException>(c => c.AutoGenerate(AutoGenerateType.AutoGenerateTimeTagRomaji));
TriggerHandlerChangedWithException<GeneratorNotSupportedException>(c => c.AutoGenerate(AutoGenerateType.AutoGenerateRomanisation));
}

#endregion
Expand Down Expand Up @@ -301,7 +301,7 @@ public void ChangeWithNormalLyric([Values] AutoGenerateType type)
PrepareHitObject(() => new Lyric
{
Text = "karaoke",
Language = new CultureInfo(17), // for auto-generate ruby and romaji.
Language = new CultureInfo(17), // for auto-generate ruby and romanisation.
TimeTags = new[] // for auto-generate notes.
{
new TimeTag(new TextIndex(0), 0),
Expand Down Expand Up @@ -361,7 +361,7 @@ public void CheckWithReferencedLyric([Values] AutoGenerateType type)
PrepareHitObject(() => new Lyric
{
Text = "karaoke",
Language = new CultureInfo(17), // for auto-generate ruby and romaji.
Language = new CultureInfo(17), // for auto-generate ruby and romanisation.
TimeTags = new[] // for auto-generate notes.
{
new TimeTag(new TextIndex(0), 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum AutoGenerateType

AutoGenerateTimeTags,

AutoGenerateTimeTagRomaji,
AutoGenerateRomanisation,

AutoGenerateNotes,
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public bool CanGenerate(AutoGenerateType type)
var timeTagGenerator = getSelector<TimeTag[], TimeTagGeneratorConfig>();
return canGenerate(timeTagGenerator);

case AutoGenerateType.AutoGenerateTimeTagRomaji:
var timeTagRomajiGenerator = getSelector<IReadOnlyDictionary<TimeTag, RomanisationGenerateResult>, RomanisationGeneratorConfig>();
return canGenerate(timeTagRomajiGenerator);
case AutoGenerateType.AutoGenerateRomanisation:
var romanisationGenerator = getSelector<IReadOnlyDictionary<TimeTag, RomanisationGenerateResult>, RomanisationGeneratorConfig>();
return canGenerate(romanisationGenerator);

case AutoGenerateType.AutoGenerateNotes:
var noteGenerator = getGenerator<Note[], NoteGeneratorConfig>();
Expand Down Expand Up @@ -95,9 +95,9 @@ public IDictionary<Lyric, LocalisableString> GetGeneratorNotSupportedLyrics(Auto
var timeTagGenerator = getSelector<TimeTag[], TimeTagGeneratorConfig>();
return getInvalidMessageFromGenerator(timeTagGenerator);

case AutoGenerateType.AutoGenerateTimeTagRomaji:
var timeTagRomajiGenerator = getSelector<IReadOnlyDictionary<TimeTag, RomanisationGenerateResult>, RomanisationGeneratorConfig>();
return getInvalidMessageFromGenerator(timeTagRomajiGenerator);
case AutoGenerateType.AutoGenerateRomanisation:
var romanisationGenerator = getSelector<IReadOnlyDictionary<TimeTag, RomanisationGenerateResult>, RomanisationGeneratorConfig>();
return getInvalidMessageFromGenerator(romanisationGenerator);

case AutoGenerateType.AutoGenerateNotes:
var noteGenerator = getGenerator<Note[], NoteGeneratorConfig>();
Expand Down Expand Up @@ -170,11 +170,11 @@ public void AutoGenerate(AutoGenerateType type)
});
break;

case AutoGenerateType.AutoGenerateTimeTagRomaji:
var timeTagRomajiGenerator = getSelector<IReadOnlyDictionary<TimeTag, RomanisationGenerateResult>, RomanisationGeneratorConfig>();
case AutoGenerateType.AutoGenerateRomanisation:
var romanisationGenerator = getSelector<IReadOnlyDictionary<TimeTag, RomanisationGenerateResult>, RomanisationGeneratorConfig>();
PerformOnSelection(lyric =>
{
var results = timeTagRomajiGenerator.Generate(lyric);
var results = romanisationGenerator.Generate(lyric);

foreach (var (key, value) in results)
{
Expand Down Expand Up @@ -213,7 +213,7 @@ protected override bool IsWritePropertyLocked(Lyric lyric) =>
AutoGenerateType.DetectLanguage => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.Language)),
AutoGenerateType.AutoGenerateRubyTags => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.RubyTags)),
AutoGenerateType.AutoGenerateTimeTags => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.TimeTags)),
AutoGenerateType.AutoGenerateTimeTagRomaji => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.TimeTags)),
AutoGenerateType.AutoGenerateRomanisation => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.TimeTags)),
AutoGenerateType.AutoGenerateNotes => HitObjectWritableUtils.IsCreateOrRemoveNoteLocked(lyric),
_ => throw new ArgumentOutOfRangeException(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private partial class RomanisationAutoGenerateSubsection : LyricEditorAutoGenera
private const string time_tag_mode = "TIME_TAG_MODE";

public RomanisationAutoGenerateSubsection()
: base(AutoGenerateType.AutoGenerateTimeTagRomaji)
: base(AutoGenerateType.AutoGenerateRomanisation)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override void LoadComplete()

// todo: we should better way to switch between time-tag mode or romaji mode.
// or even create new step for it.
if (lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateTimeTagRomaji))
if (lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateRomanisation))
{
AskForAutoGenerateRomanisation();
}
Expand Down