Skip to content

Commit

Permalink
Merge pull request #2187 from andy840119/romaji-to-romanisation-in-th…
Browse files Browse the repository at this point in the history
…e-generator

Romaji to romanization in the generator.
  • Loading branch information
andy840119 authored Mar 10, 2024
2 parents 11fd78b + b6d30b6 commit e66ad2e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
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

0 comments on commit e66ad2e

Please sign in to comment.