Skip to content

Commit

Permalink
Merge pull request #2196 from andy840119/rename-from-romaji-to-romani…
Browse files Browse the repository at this point in the history
…zation

Rename remaining `romaji` to `romanisation`.
  • Loading branch information
andy840119 authored Mar 17, 2024
2 parents 5ddaaa8 + 23a5fbd commit 2e0eedd
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void TestDecodeEncodedBeatmap(string fileName)
{
var decoded = decode(fileName, out var encoded);

// Note : this test case does not cover ruby and romaji property
// Note : this test case does not cover ruby property
Assert.That(decoded.HitObjects.Count, Is.EqualTo(encoded.HitObjects.Count));
Assert.That(encoded.Serialize(), Is.EqualTo(decoded.Serialize()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public static Lyric ParseLyricWithTimeTag(string? str)
/// </summary>
/// <example>
/// [0]name:singer001 -> singer with id and name.<br/>
/// [0]romaji:singer001 -> singer with id and romaji.<br/>
/// [0]romanisation:singer001 -> singer with id and romanisation.<br/>
/// [0]eg:singer001 -> singer with id and english name.<br/>
/// </example>
/// <param name="str">Singer string format</param>
Expand Down
8 changes: 4 additions & 4 deletions osu.Game.Rulesets.Karaoke.Tests/Objects/LyricTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void TestReferenceLyricPropertyChanged()
public void TestReferenceLyricListPropertyChanged()
{
// test modify property inside the list.
// ruby, romaji tag time-tag.
// e.g. ruby, time-tag and romanisation.
var timeTag = TestCaseTagHelper.ParseTimeTag("[0,start]:1100#^ka");
var rubyTag = TestCaseTagHelper.ParseRubyTag("[0]:か");

Expand Down Expand Up @@ -191,12 +191,12 @@ public void TestReferenceLyricListPropertyChanged()

// and because there's no change inside the tag, so there's version change.
Assert.AreEqual(0, lyric.TimeTagsTimingVersion.Value);
Assert.AreEqual(0, lyric.TimeTagsRomajiVersion.Value);
Assert.AreEqual(0, lyric.TimeTagsRomanisationVersion.Value);
Assert.AreEqual(0, lyric.RubyTagsVersion.Value);

// it's time to change the property in the list.
timeTag.Time = 2000;
timeTag.RomanisedSyllable = "romaji";
timeTag.RomanisedSyllable = "ka--";
rubyTag.Text = "ruby";

// property should be equal.
Expand All @@ -205,7 +205,7 @@ public void TestReferenceLyricListPropertyChanged()

// and note that because only one property is different, so version should change once.
Assert.AreEqual(1, lyric.TimeTagsTimingVersion.Value);
Assert.AreEqual(1, lyric.TimeTagsRomajiVersion.Value);
Assert.AreEqual(1, lyric.TimeTagsRomanisationVersion.Value);
Assert.AreEqual(1, lyric.RubyTagsVersion.Value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void TestEditTimeTagMode()
}

[Test]
public void TestEditRomajiMode()
public void TestEditRomanisation()
{
switchToMode(LyricEditorMode.EditRomanisation);
clickEditStepButtons<RomanisationTagEditStep>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line)
return;
}

if (line.ToLower().StartsWith("@ruby", StringComparison.Ordinal) || line.ToLower().StartsWith("@romaji", StringComparison.Ordinal))
if (line.ToLower().StartsWith("@ruby", StringComparison.Ordinal))
{
// lrc queue
lrcLines.Add(line);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ protected override void InitialiseDefaults()

// Lyric
SetDefault(KaraokeRulesetEditCheckerSetting.LyricRubyPositionSorting, RubyTagsUtils.Sorting.Asc);
SetDefault(KaraokeRulesetEditCheckerSetting.LyricRomajiPositionSorting, RubyTagsUtils.Sorting.Asc);
SetDefault(KaraokeRulesetEditCheckerSetting.LyricTimeTagTimeSelfCheck, SelfCheck.BasedOnStart);
SetDefault(KaraokeRulesetEditCheckerSetting.LyricTimeTagTimeGroupCheck, GroupCheck.Asc);
}
Expand All @@ -23,7 +22,6 @@ protected override void InitialiseDefaults()
public enum KaraokeRulesetEditCheckerSetting
{
LyricRubyPositionSorting,
LyricRomajiPositionSorting,
LyricTimeTagTimeSelfCheck,
LyricTimeTagTimeGroupCheck,
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected class AvailableProperty : IDisposable
public readonly IBindable<int> RubyTagsVersion = new Bindable<int>();
public readonly IBindable<string> TextBindable = new Bindable<string>();
public readonly IBindableList<TimeTag> TimeTagsBindable = new BindableList<TimeTag>();
public readonly IBindable<int> TimeTagsRomajiVersion = new Bindable<int>();
public readonly IBindable<int> TimeTagsRomanisationVersion = new Bindable<int>();
public readonly IBindable<int> TimeTagsTimingVersion = new Bindable<int>();

public AvailableProperty(Lyric lyric)
Expand All @@ -96,7 +96,7 @@ public AvailableProperty(Lyric lyric)
RubyTagsVersion.BindTo(lyric.RubyTagsVersion);
TextBindable.BindTo(lyric.TextBindable);
TimeTagsBindable.BindTo(lyric.TimeTagsBindable);
TimeTagsRomajiVersion.BindTo(lyric.TimeTagsRomajiVersion);
TimeTagsRomanisationVersion.BindTo(lyric.TimeTagsRomanisationVersion);
TimeTagsTimingVersion.BindTo(lyric.TimeTagsTimingVersion);
}

Expand All @@ -106,7 +106,7 @@ public void Dispose()
RubyTagsVersion.UnbindAll();
TextBindable.UnbindAll();
TimeTagsBindable.UnbindAll();
TimeTagsRomajiVersion.UnbindAll();
TimeTagsRomanisationVersion.UnbindAll();
TimeTagsTimingVersion.UnbindAll();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override void ProcessBindableChange(AvailableProperty property)
UpdateBottomText();
UpdateTimeTags();
});
property.TimeTagsRomajiVersion.BindValueChanged(_ =>
property.TimeTagsRomanisationVersion.BindValueChanged(_ =>
{
UpdateBottomText();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override void ProcessBindableChange(AvailableProperty property)
// Ruby change might affect the center text, which will affect all property.
UpdateAll();
});
property.TimeTagsRomajiVersion.BindValueChanged(_ =>
property.TimeTagsRomanisationVersion.BindValueChanged(_ =>
{
// Ruby change might affect the center text, which will affect all property.
UpdateAll();
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) =
new KeyBinding(new[] { InputKey.Alt, InputKey.BracketLeft }, KaraokeEditAction.PreviousEditMode),
new KeyBinding(new[] { InputKey.Alt, InputKey.BracketRight }, KaraokeEditAction.NextEditMode),

// Edit Ruby / romaji tag.
// Edit Ruby tag.
new KeyBinding(new[] { InputKey.Z, InputKey.Left }, KaraokeEditAction.EditRubyTagReduceStartIndex),
new KeyBinding(new[] { InputKey.Z, InputKey.Right }, KaraokeEditAction.EditRubyTagIncreaseStartIndex),
new KeyBinding(new[] { InputKey.X, InputKey.Left }, KaraokeEditAction.EditRubyTagReduceEndIndex),
Expand Down
12 changes: 6 additions & 6 deletions osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public partial class Lyric
private readonly Bindable<int> timeTagsTimingVersion = new();

[JsonIgnore]
public IBindable<int> TimeTagsRomajiVersion => timeTagsRomajiVersion;
public IBindable<int> TimeTagsRomanisationVersion => timeTagsRomanisationVersion;

private readonly Bindable<int> timeTagsRomajiVersion = new();
private readonly Bindable<int> timeTagsRomanisationVersion = new();

[JsonIgnore]
public IBindable<int> RubyTagsVersion => rubyTagsVersion;
Expand Down Expand Up @@ -56,7 +56,7 @@ private void initInternalBindingEvent()
foreach (var c in args.NewItems.Cast<TimeTag>())
{
c.TimingChanged += timingInvalidate;
c.SyllableChanged += romajiInvalidate;
c.SyllableChanged += romanisationInvalidate;
}

break;
Expand All @@ -68,7 +68,7 @@ private void initInternalBindingEvent()
foreach (var c in args.OldItems.Cast<TimeTag>())
{
c.TimingChanged -= timingInvalidate;
c.SyllableChanged -= romajiInvalidate;
c.SyllableChanged -= romanisationInvalidate;
}

break;
Expand All @@ -77,7 +77,7 @@ private void initInternalBindingEvent()
updateLyricTime();

void timingInvalidate() => timeTagsTimingVersion.Value++;
void romajiInvalidate() => timeTagsRomajiVersion.Value++;
void romanisationInvalidate() => timeTagsRomanisationVersion.Value++;
};

TimeTagsTimingVersion.ValueChanged += _ =>
Expand Down Expand Up @@ -191,7 +191,7 @@ private void initReferenceLyricEvent()
});
}, false);

bindValueChange(e, l => l.TimeTagsRomajiVersion, (_, config) =>
bindValueChange(e, l => l.TimeTagsRomanisationVersion, (_, config) =>
{
if (config is not SyncLyricConfig syncLyricConfig || !syncLyricConfig.SyncTimeTagProperty)
return;
Expand Down
9 changes: 6 additions & 3 deletions osu.Game.Rulesets.Karaoke/Objects/TimeTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public double? Time
public readonly Bindable<bool> FirstSyllableBindable = new();

/// <summary>
/// Mark if this romaji is the first letter of the romaji word.
/// Mark if this romanised syllable is the first letter of the romanisation.
/// </summary>
/// <example>
/// There's the Japanese lyric:<br/>
/// 枯れた世界に輝く<br/>
/// There's the Romaji:<br/>
/// There's the romanisation:<br/>
/// kareta sekai ni kagayaku.<br/>
/// And it will be separated as:<br/>
/// ka|re|ta se|kai ni ka|ga|ya|ku.<br/>
Expand All @@ -75,8 +75,11 @@ public bool FirstSyllable
public readonly Bindable<string?> RomanisedSyllableBindable = new();

/// <summary>
/// Romaji
/// Romanised syllable
/// </summary>
/// <example>
/// Ka, ra, o, ke.
/// </example>
public string? RomanisedSyllable
{
get => RomanisedSyllableBindable.Value;
Expand Down
5 changes: 3 additions & 2 deletions osu.Game.Rulesets.Karaoke/Objects/Utils/LyricUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public static void RemoveText(Lyric lyric, int charGap, int count = 1)
if (charGap + count >= textLength)
count = textLength - charGap;

// deal with ruby and romaji, might remove and shifting.
// deal with ruby and romanisation.
// might remove and shifting.
lyric.RubyTags = processTags(lyric.RubyTags, charGap, count);
lyric.TimeTags = processTimeTags(lyric.TimeTags, charGap, count);

Expand Down Expand Up @@ -88,7 +89,7 @@ public static void AddText(Lyric lyric, int charGap, string text)
if (offset == 0)
return;

// deal with ruby and romaji with shifting.
// deal with ruby and romanisation with shifting.
lyric.RubyTags = processTags(lyric.RubyTags, charGap, offset);
lyric.TimeTags = processTimeTags(lyric.TimeTags, charGap, offset);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ private void load(ISkinSource skin, ShaderManager? shaderManager)
// Apply text font info
var lyricFont = newConfig.MainTextFont;
var rubyFont = newConfig.RubyTextFont;
var romajiFont = newConfig.RomanisationTextFont;
var romanisationTextFont = newConfig.RomanisationTextFont;

Font = getFont(lyricFont.Size);
TopTextFont = getFont(rubyFont.Size);
BottomTextFont = getFont(romajiFont.Size);
BottomTextFont = getFont(romanisationTextFont.Size);

triggerSizeChangedEvent();

Expand All @@ -251,6 +251,6 @@ public Vector2 GetTimeTagPosition(TextIndex index)
return TextIndexUtils.GetValueByState(index, drawRectangle.BottomLeft, drawRectangle.BottomRight);
}

// todo: get romanization position.
// todo: get romanisation position.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected override Section[] CreatePropertiesContainer()
{
new IntervalSection(),
new PositionSection(),
new RubyRomajiSection(),
new RubyAndRomanisationSection(),
};

protected override Container CreatePreviewArea()
Expand Down
12 changes: 6 additions & 6 deletions osu.Game.Rulesets.Karaoke/Screens/Skin/Config/IntervalSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal partial class IntervalSection : LyricConfigSection
{
private readonly LabelledRealTimeSliderBar<int> lyricIntervalSliderBar;
private readonly LabelledRealTimeSliderBar<int> rubyIntervalSliderBar;
private readonly LabelledRealTimeSliderBar<int> romajiIntervalSliderBar;
private readonly LabelledRealTimeSliderBar<int> romanisationIntervalSliderBar;

protected override LocalisableString Title => "Interval";

Expand Down Expand Up @@ -44,10 +44,10 @@ public IntervalSection()
Default = 10,
},
},
romajiIntervalSliderBar = new LabelledRealTimeSliderBar<int>
romanisationIntervalSliderBar = new LabelledRealTimeSliderBar<int>
{
Label = "Romaji interval",
Description = "Romaji interval section",
Label = "Romanisation interval",
Description = "Romanisation interval section",
Current = new BindableNumber<int>
{
MinValue = 0,
Expand All @@ -67,14 +67,14 @@ private void load(LyricFontInfoManager lyricFontInfoManager)
var lyricFontInfo = e.NewValue;
applyCurrent(lyricIntervalSliderBar.Current, lyricFontInfo.LyricsInterval);
applyCurrent(rubyIntervalSliderBar.Current, lyricFontInfo.RubyInterval);
applyCurrent(romajiIntervalSliderBar.Current, lyricFontInfo.RomanisationInterval);
applyCurrent(romanisationIntervalSliderBar.Current, lyricFontInfo.RomanisationInterval);

static void applyCurrent<T>(Bindable<T> bindable, T value)
=> bindable.Value = bindable.Default = value;
}, true);

lyricIntervalSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.LyricsInterval = x.NewValue));
rubyIntervalSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RubyInterval = x.NewValue));
romajiIntervalSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RomanisationInterval = x.NewValue));
romanisationIntervalSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RomanisationInterval = x.NewValue));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

namespace osu.Game.Rulesets.Karaoke.Screens.Skin.Config;

internal partial class RubyRomajiSection : LyricConfigSection
internal partial class RubyAndRomanisationSection : LyricConfigSection
{
private readonly LabelledEnumDropdown<LyricTextAlignment> rubyAlignmentDropdown;
private readonly LabelledEnumDropdown<LyricTextAlignment> romajiAlignmentDropdown;
private readonly LabelledEnumDropdown<LyricTextAlignment> romanisationAlignmentDropdown;
private readonly LabelledRealTimeSliderBar<int> rubyMarginSliderBar;
private readonly LabelledRealTimeSliderBar<int> romajiMarginSliderBar;
private readonly LabelledRealTimeSliderBar<int> romanisationMarginSliderBar;

protected override LocalisableString Title => "Ruby/Romaji";
protected override LocalisableString Title => "Ruby/Romanisation";

public RubyRomajiSection()
public RubyAndRomanisationSection()
{
Children = new Drawable[]
{
Expand All @@ -29,10 +29,10 @@ public RubyRomajiSection()
Label = "Ruby alignment",
Description = "Ruby alignment section",
},
romajiAlignmentDropdown = new LabelledEnumDropdown<LyricTextAlignment>
romanisationAlignmentDropdown = new LabelledEnumDropdown<LyricTextAlignment>
{
Label = "Romaji alignment",
Description = "Romaji alignment section",
Label = "Romanisation alignment",
Description = "Romanisation alignment section",
},
rubyMarginSliderBar = new LabelledRealTimeSliderBar<int>
{
Expand All @@ -46,10 +46,10 @@ public RubyRomajiSection()
Default = 10,
},
},
romajiMarginSliderBar = new LabelledRealTimeSliderBar<int>
romanisationMarginSliderBar = new LabelledRealTimeSliderBar<int>
{
Label = "Romaji margin",
Description = "Romaji margin section",
Label = "Romanisation margin",
Description = "Romanisation margin section",
Current = new BindableNumber<int>
{
MinValue = 0,
Expand All @@ -68,17 +68,17 @@ private void load(LyricFontInfoManager lyricFontInfoManager)
{
var lyricFontInfo = e.NewValue;
applyCurrent(rubyAlignmentDropdown.Current, lyricFontInfo.RubyAlignment);
applyCurrent(romajiAlignmentDropdown.Current, lyricFontInfo.RomanisationAlignment);
applyCurrent(romanisationAlignmentDropdown.Current, lyricFontInfo.RomanisationAlignment);
applyCurrent(rubyMarginSliderBar.Current, lyricFontInfo.RubyMargin);
applyCurrent(romajiMarginSliderBar.Current, lyricFontInfo.RomanisationMargin);
applyCurrent(romanisationMarginSliderBar.Current, lyricFontInfo.RomanisationMargin);

static void applyCurrent<T>(Bindable<T> bindable, T value)
=> bindable.Value = bindable.Default = value;
}, true);

rubyAlignmentDropdown.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RubyAlignment = x.NewValue));
romajiAlignmentDropdown.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RomanisationAlignment = x.NewValue));
romanisationAlignmentDropdown.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RomanisationAlignment = x.NewValue));
rubyMarginSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RubyMargin = x.NewValue));
romajiMarginSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RomanisationMargin = x.NewValue));
romanisationMarginSliderBar.Current.BindValueChanged(x => lyricFontInfoManager.ApplyCurrentLyricFontInfoChange(l => l.RomanisationMargin = x.NewValue));
}
}

0 comments on commit 2e0eedd

Please sign in to comment.