From ed725162cda4f306e447843e0025f0c2dbb9318f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 4 Jul 2024 00:59:56 +0800 Subject: [PATCH 01/12] Rename in the lyric object. --- .../Formats/KaraokeLegacyBeatmapDecoderTest.cs | 12 ++++++------ .../BeatmapLanguagesChangeHandlerTest.cs | 2 +- .../Lyrics/LyricTranslateChangeHandlerTest.cs | 18 +++++++++--------- .../CheckBeatmapAvailableTranslatesTest.cs | 2 +- .../Editor/Checks/CheckLyricTranslateTest.cs | 4 ++-- .../Converters/LyricConverterTest.cs | 8 ++++---- .../KaraokeJsonSerializableExtensionsTest.cs | 4 ++-- .../Objects/LyricTest.cs | 18 +++++++++--------- .../Skinning/TestSceneLyric.cs | 2 +- .../Formats/KaraokeLegacyBeatmapDecoder.cs | 2 +- .../Formats/KaraokeLegacyBeatmapEncoder.cs | 2 +- .../Beatmaps/BeatmapLanguagesChangeHandler.cs | 6 +++--- .../Lyrics/LyricTranslateChangeHandler.cs | 10 +++++----- .../Checks/CheckBeatmapAvailableTranslates.cs | 6 +++--- .../Edit/Checks/CheckLyricTranslate.cs | 2 +- .../Edit/Utils/HitObjectWritableUtils.cs | 4 ++-- .../Serialization/Converters/LyricConverter.cs | 2 +- .../Objects/Drawables/DrawableLyric.cs | 4 ++-- osu.Game.Rulesets.Karaoke/Objects/Lyric.cs | 12 ++++++------ .../Objects/Lyric_Binding.cs | 6 +++--- .../Beatmaps/Translate/TranslateEditSection.cs | 2 +- .../Settings/Previews/Gameplay/LyricPreview.cs | 2 +- 22 files changed, 65 insertions(+), 65 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs index f183f6e78..b77d0fdf7 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs @@ -93,18 +93,18 @@ public void TestDecodeTranslate() Assert.AreEqual(2, translates.Count); // All lyric should have two translates - Assert.AreEqual(2, lyrics[0].Translates.Count); - Assert.AreEqual(2, lyrics[1].Translates.Count); + Assert.AreEqual(2, lyrics[0].Translations.Count); + Assert.AreEqual(2, lyrics[1].Translations.Count); // Check chinese translate var chineseLanguageId = translates[0]; - Assert.AreEqual("卡拉OK", lyrics[0].Translates[chineseLanguageId]); - Assert.AreEqual("喜歡", lyrics[1].Translates[chineseLanguageId]); + Assert.AreEqual("卡拉OK", lyrics[0].Translations[chineseLanguageId]); + Assert.AreEqual("喜歡", lyrics[1].Translations[chineseLanguageId]); // Check english translate var englishLanguageId = translates[1]; - Assert.AreEqual("karaoke", lyrics[0].Translates[englishLanguageId]); - Assert.AreEqual("like it", lyrics[1].Translates[englishLanguageId]); + Assert.AreEqual("karaoke", lyrics[0].Translations[englishLanguageId]); + Assert.AreEqual("like it", lyrics[1].Translations[englishLanguageId]); } private static KaraokeBeatmap decodeBeatmap(string fileName) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs index 44cdb094d..0ee808f21 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs @@ -75,7 +75,7 @@ public void TestIsLanguageContainsTranslate() PrepareHitObject(() => new Lyric { - Translates = new Dictionary + Translations = new Dictionary { { new("zh-TW"), "卡拉 OK" diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs index 4db43ad94..8cb628e51 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs @@ -24,8 +24,8 @@ public void TestUpdateTranslateWithNewLanguage() AssertSelectedHitObject(h => { - Assert.AreEqual(1, h.Translates.Count); - Assert.AreEqual("からおけ", h.Translates[new CultureInfo(17)]); + Assert.AreEqual(1, h.Translations.Count); + Assert.AreEqual("からおけ", h.Translations[new CultureInfo(17)]); }); } @@ -35,7 +35,7 @@ public void TestUpdateTranslateWithExistLanguage() PrepareHitObject(() => new Lyric { Text = "カラオケ", - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }, @@ -45,8 +45,8 @@ public void TestUpdateTranslateWithExistLanguage() AssertSelectedHitObject(h => { - Assert.AreEqual(1, h.Translates.Count); - Assert.AreEqual("karaoke", h.Translates[new CultureInfo(17)]); + Assert.AreEqual(1, h.Translations.Count); + Assert.AreEqual("karaoke", h.Translations[new CultureInfo(17)]); }); } @@ -56,7 +56,7 @@ public void TestUpdateTranslateWithEmptyText() PrepareHitObject(() => new Lyric { Text = "カラオケ", - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }, @@ -66,7 +66,7 @@ public void TestUpdateTranslateWithEmptyText() AssertSelectedHitObject(h => { - Assert.IsEmpty(h.Translates); + Assert.IsEmpty(h.Translations); }); } @@ -76,7 +76,7 @@ public void TestUpdateTranslateWithNullText() PrepareHitObject(() => new Lyric { Text = "カラオケ", - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }, @@ -86,7 +86,7 @@ public void TestUpdateTranslateWithNullText() AssertSelectedHitObject(h => { - Assert.IsEmpty(h.Translates); + Assert.IsEmpty(h.Translations); }); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs index 8dd60aaa9..da42f9908 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs @@ -137,7 +137,7 @@ private static Lyric createLyric(CultureInfo? cultureInfo = null, string transla if (cultureInfo == null) return lyric; - lyric.Translates.Add(cultureInfo, translate); + lyric.Translations.Add(cultureInfo, translate); return lyric; } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs index 920ca82b8..6365fac00 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs @@ -20,7 +20,7 @@ public void TestCheck(string text) { var lyric = new Lyric { - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo("Ja-jp"), text }, }, @@ -37,7 +37,7 @@ public void TestCheckEmptyText(string text) { var lyric = new Lyric { - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo("Ja-jp"), text }, }, diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConverterTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConverterTest.cs index 2d1c58bc0..9c7d3c325 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConverterTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConverterTest.cs @@ -25,7 +25,7 @@ public void TestLyricConverterWithNoConfig() var lyric = new Lyric(); string expected = - $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"id\":\"{lyric.ID}\",\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"singer_ids\":[],\"translates\":{{}},\"samples\":[],\"auxiliary_samples\":[]}}"; + $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"id\":\"{lyric.ID}\",\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"singer_ids\":[],\"translations\":{{}},\"samples\":[],\"auxiliary_samples\":[]}}"; string actual = JsonConvert.SerializeObject(lyric, CreateSettings()); Assert.AreEqual(expected, actual); } @@ -36,7 +36,7 @@ public void TestDeserializeWithNoConfig() var expected = new Lyric(); string json = - $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"id\":\"{expected.ID}\",\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"singer_ids\":[],\"translates\":{{}},\"samples\":[],\"auxiliary_samples\":[]}}"; + $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"id\":\"{expected.ID}\",\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"singer_ids\":[],\"translations\":{{}},\"samples\":[],\"auxiliary_samples\":[]}}"; var actual = JsonConvert.DeserializeObject(json, CreateSettings())!; Assert.AreEqual(expected.ID, actual.ID); @@ -47,7 +47,7 @@ public void TestDeserializeWithNoConfig() Assert.AreEqual(expected.StartTime, actual.StartTime); Assert.AreEqual(expected.Duration, actual.Duration); Assert.AreEqual(expected.SingerIds, actual.SingerIds); - Assert.AreEqual(expected.Translates, actual.Translates); + Assert.AreEqual(expected.Translations, actual.Translations); Assert.AreEqual(expected.Language, actual.Language); Assert.AreEqual(expected.Lock, actual.Lock); Assert.AreEqual(expected.ReferenceLyric, actual.ReferenceLyric); @@ -84,7 +84,7 @@ public void TestLyricConverterWithReferenceConfig() }; string expected = - $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"id\":\"{lyric.ID}\",\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"singer_ids\":[],\"translates\":{{}},\"reference_lyric_id\":\"{lyric.ReferenceLyricId}\",\"reference_lyric_config\":{{\"$type\":\"ReferenceLyricConfig\"}},\"samples\":[],\"auxiliary_samples\":[]}}"; + $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"id\":\"{lyric.ID}\",\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"singer_ids\":[],\"translations\":{{}},\"reference_lyric_id\":\"{lyric.ReferenceLyricId}\",\"reference_lyric_config\":{{\"$type\":\"ReferenceLyricConfig\"}},\"samples\":[],\"auxiliary_samples\":[]}}"; string actual = JsonConvert.SerializeObject(lyric, CreateSettings()); Assert.AreEqual(expected, actual); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs index b46724fee..4466eabad 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs @@ -17,7 +17,7 @@ public void TestSerializeLyric() var lyric = new Lyric(); string expected = - @$"{{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""id"":""{lyric.ID}"",""text"":"""",""time_tags"":[],""ruby_tags"":[],""singer_ids"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}}"; + @$"{{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""id"":""{lyric.ID}"",""text"":"""",""time_tags"":[],""ruby_tags"":[],""singer_ids"":[],""translations"":[],""samples"":[],""auxiliary_samples"":[]}}"; string actual = JsonConvert.SerializeObject(lyric, createSettings()); Assert.AreEqual(expected, actual); @@ -28,7 +28,7 @@ public void TestDeserializeLyric() { var expected = new Lyric(); string json = - @$"{{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""id"":""{expected.ID}"",""text"":"""",""time_tags"":[],""ruby_tags"":[],""singer_ids"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}}"; + @$"{{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""id"":""{expected.ID}"",""text"":"""",""time_tags"":[],""ruby_tags"":[],""singer_ids"":[],""translations"":[],""samples"":[],""auxiliary_samples"":[]}}"; var actual = JsonConvert.DeserializeObject(json, createSettings())!; ObjectAssert.ArePropertyEqual(expected, actual); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Objects/LyricTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Objects/LyricTest.cs index 25cce6ae6..c9f7465f1 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Objects/LyricTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Objects/LyricTest.cs @@ -29,7 +29,7 @@ public void TestClone() StartTime = 1000, Duration = 4000, SingerIds = TestCaseElementIdHelper.CreateElementIdsByNumbers(new[] { 1, 2 }), - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo("en-US"), "karaoke" }, }, @@ -69,8 +69,8 @@ public void TestClone() Assert.AreNotSame(clonedLyric.SingerIdsBindable, lyric.SingerIdsBindable); CollectionAssert.AreEquivalent(clonedLyric.SingerIds, lyric.SingerIds); - Assert.AreNotSame(clonedLyric.TranslateTextBindable, lyric.TranslateTextBindable); - CollectionAssert.AreEquivalent(clonedLyric.Translates, lyric.Translates); + Assert.AreNotSame(clonedLyric.TranslationsBindable, lyric.TranslationsBindable); + CollectionAssert.AreEquivalent(clonedLyric.Translations, lyric.Translations); Assert.AreNotSame(clonedLyric.LanguageBindable, lyric.LanguageBindable); Assert.AreEqual(clonedLyric.Language, lyric.Language); @@ -103,7 +103,7 @@ public void TestSyncFromReferenceLyric() TimeTags = TestCaseTagHelper.ParseTimeTags(new[] { "[0,start]:1100#^ka" }), RubyTags = TestCaseTagHelper.ParseRubyTags(new[] { "[0]:か" }), SingerIds = TestCaseElementIdHelper.CreateElementIdsByNumbers(new[] { 1 }), - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }, @@ -121,7 +121,7 @@ public void TestSyncFromReferenceLyric() TimeTagAssert.ArePropertyEqual(referencedLyric.TimeTags, lyric.TimeTags); RubyTagAssert.ArePropertyEqual(referencedLyric.RubyTags, lyric.RubyTags); Assert.AreEqual(referencedLyric.SingerIds, lyric.SingerIds); - Assert.AreEqual(referencedLyric.Translates, lyric.Translates); + Assert.AreEqual(referencedLyric.Translations, lyric.Translations); Assert.AreEqual(referencedLyric.Language, lyric.Language); } @@ -141,7 +141,7 @@ public void TestReferenceLyricPropertyChanged() referencedLyric.TimeTags = TestCaseTagHelper.ParseTimeTags(new[] { "[0,start]:1100^ka" }); referencedLyric.RubyTags = TestCaseTagHelper.ParseRubyTags(new[] { "[0]:か" }); referencedLyric.SingerIds = TestCaseElementIdHelper.CreateElementIdsByNumbers(new[] { 1 }); - referencedLyric.Translates = new Dictionary + referencedLyric.Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }; @@ -151,7 +151,7 @@ public void TestReferenceLyricPropertyChanged() TimeTagAssert.ArePropertyEqual(referencedLyric.TimeTags, lyric.TimeTags); RubyTagAssert.ArePropertyEqual(referencedLyric.RubyTags, lyric.RubyTags); Assert.AreEqual(referencedLyric.SingerIds, lyric.SingerIds); - Assert.AreEqual(referencedLyric.Translates, lyric.Translates); + Assert.AreEqual(referencedLyric.Translations, lyric.Translations); Assert.AreEqual(referencedLyric.Language, lyric.Language); } @@ -169,7 +169,7 @@ public void TestReferenceLyricListPropertyChanged() TimeTags = new[] { timeTag }, RubyTags = new[] { rubyTag }, SingerIds = TestCaseElementIdHelper.CreateElementIdsByNumbers(new[] { 1 }), - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }, @@ -224,7 +224,7 @@ public void TestConfigChange() TimeTags = TestCaseTagHelper.ParseTimeTags(new[] { "[0,start]:1100#ka" }), RubyTags = TestCaseTagHelper.ParseRubyTags(new[] { "[0]:か" }), SingerIds = TestCaseElementIdHelper.CreateElementIdsByNumbers(new[] { 1 }), - Translates = new Dictionary + Translations = new Dictionary { { new CultureInfo(17), "からおけ" }, }, diff --git a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs index a0990a813..fe0d9737f 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs @@ -91,7 +91,7 @@ private Drawable testSingle(double timeOffset = 0) }, new PreviewStageDefinition()), }; - lyric.Translates.Add(cultureInfo, "karaoke"); + lyric.Translations.Add(cultureInfo, "karaoke"); lyric.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs index c7c1ae2fb..c71a93775 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs @@ -247,7 +247,7 @@ private void processTranslate(Beatmap beatmap, IEnumerable translateLine for (int j = 0; j < size; j++) { - lyrics[j].Translates.Add(cultureInfo, values[j]); + lyrics[j].Translations.Add(cultureInfo, values[j]); } availableTranslates.Add(cultureInfo); diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs index c9277f66e..3d754bbba 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs @@ -73,7 +73,7 @@ private IEnumerable encodeTranslate(Beatmap output) { foreach (var lyric in lyrics) { - string translateString = lyric.Translates.TryGetValue(translate, out string? value) ? value : string.Empty; + string translateString = lyric.Translations.TryGetValue(translate, out string? value) ? value : string.Empty; yield return $"@tr[{translate.Name}]={translateString}"; } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs index e565d9b53..cdfecab70 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs @@ -24,12 +24,12 @@ protected override void OnItemAdded(CultureInfo item) protected override void OnItemRemoved(CultureInfo item) { // Delete from lyric also. - foreach (var lyric in Lyrics.Where(lyric => lyric.Translates.ContainsKey(item))) + foreach (var lyric in Lyrics.Where(lyric => lyric.Translations.ContainsKey(item))) { - lyric.Translates.Remove(item); + lyric.Translations.Remove(item); } } public bool IsLanguageContainsTranslate(CultureInfo cultureInfo) - => Lyrics.Any(x => x.Translates.ContainsKey(cultureInfo)); + => Lyrics.Any(x => x.Translations.ContainsKey(cultureInfo)); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs index 17d0dea3b..1985fee2b 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs @@ -19,17 +19,17 @@ public void UpdateTranslate(CultureInfo cultureInfo, string translate) // should not save translate if is null or empty or whitespace if (string.IsNullOrWhiteSpace(translate)) { - if (lyric.Translates.ContainsKey(cultureInfo)) - lyric.Translates.Remove(cultureInfo); + if (lyric.Translations.ContainsKey(cultureInfo)) + lyric.Translations.Remove(cultureInfo); } else { - if (!lyric.Translates.TryAdd(cultureInfo, translate)) - lyric.Translates[cultureInfo] = translate; + if (!lyric.Translations.TryAdd(cultureInfo, translate)) + lyric.Translations[cultureInfo] = translate; } }); } protected override bool IsWritePropertyLocked(Lyric lyric) - => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.Translates)); + => HitObjectWritableUtils.IsWriteLyricPropertyLocked(lyric, nameof(Lyric.Translations)); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs index 41a058711..2a1ec0c79 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs @@ -39,7 +39,7 @@ protected override IEnumerable CheckHitObjects(IList propert // check if some translate is missing or empty. foreach (var language in property) { - var notTranslateLyrics = hitObject.Where(x => !x.Translates.ContainsKey(language) || string.IsNullOrWhiteSpace(x.Translates[language])).ToArray(); + var notTranslateLyrics = hitObject.Where(x => !x.Translations.ContainsKey(language) || string.IsNullOrWhiteSpace(x.Translations[language])).ToArray(); if (notTranslateLyrics.Length == hitObject.Count) { @@ -53,12 +53,12 @@ protected override IEnumerable CheckHitObjects(IList propert // should check is lyric contains translate that is not listed in beatmap. // if got this issue, then it's a bug. - var allTranslateLanguageInLyric = hitObject.SelectMany(x => x.Translates.Keys).Distinct(); + var allTranslateLanguageInLyric = hitObject.SelectMany(x => x.Translations.Keys).Distinct(); var languageNotListInBeatmap = allTranslateLanguageInLyric.Except(property); foreach (var language in languageNotListInBeatmap) { - var notTranslateLyrics = hitObject.Where(x => !x.Translates.ContainsKey(language)); + var notTranslateLyrics = hitObject.Where(x => !x.Translations.ContainsKey(language)); yield return new IssueTemplateContainsNotListedLanguage(this).Create(notTranslateLyrics, language); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs index eb938d842..0d0aa3c5c 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs @@ -20,7 +20,7 @@ public class CheckLyricTranslate : CheckHitObjectProperty protected override IEnumerable Check(Lyric lyric) { - var translates = lyric.Translates; + var translates = lyric.Translations; foreach ((var language, string translate) in translates) { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Utils/HitObjectWritableUtils.cs b/osu.Game.Rulesets.Karaoke/Edit/Utils/HitObjectWritableUtils.cs index a8aad8149..f0d82fdd3 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Utils/HitObjectWritableUtils.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Utils/HitObjectWritableUtils.cs @@ -80,7 +80,7 @@ private static bool isWriteLyricPropertyLockedByState(LockState lockState, strin nameof(Lyric.StartTime) => lockState > LockState.Partial, nameof(Lyric.Duration) => lockState > LockState.Partial, nameof(Lyric.SingerIds) => lockState > LockState.Partial, - nameof(Lyric.Translates) => lockState > LockState.Partial, + nameof(Lyric.Translations) => lockState > LockState.Partial, nameof(Lyric.Language) => lockState > LockState.Partial, nameof(Lyric.Order) => false, // order can always be changed. nameof(Lyric.Lock) => false, // order can always be changed. @@ -106,7 +106,7 @@ private static bool isWriteLyricPropertyLockedByConfig(IReferenceLyricPropertyCo nameof(Lyric.StartTime) => false, nameof(Lyric.Duration) => false, nameof(Lyric.SingerIds) => syncLyricConfig.SyncSingerProperty, - nameof(Lyric.Translates) => true, + nameof(Lyric.Translations) => true, nameof(Lyric.Language) => true, nameof(Lyric.Order) => true, nameof(Lyric.Lock) => true, diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConverter.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConverter.cs index f216b69f8..8885806a9 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConverter.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/LyricConverter.cs @@ -78,7 +78,7 @@ private IEnumerable removePropertyNamesByConfig(IReferenceLyricPropertyC if (syncLyricConfig.SyncSingerProperty) yield return nameof(Lyric.SingerIds); - yield return nameof(Lyric.Translates); + yield return nameof(Lyric.Translations); yield return nameof(Lyric.Language); yield return nameof(Lyric.Order); diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs index dd68787b6..47d42c26c 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs @@ -121,7 +121,7 @@ protected override void OnApply() ApplySkin(CurrentSkin, false); singersBindable.BindTo(HitObject.SingersBindable); - translateTextBindable.BindTo(HitObject.TranslateTextBindable); + translateTextBindable.BindTo(HitObject.TranslationsBindable); } protected override void OnFree() @@ -129,7 +129,7 @@ protected override void OnFree() base.OnFree(); singersBindable.UnbindFrom(HitObject.SingersBindable); - translateTextBindable.UnbindFrom(HitObject.TranslateTextBindable); + translateTextBindable.UnbindFrom(HitObject.TranslationsBindable); } protected override void ApplySkin(ISkinSource skin, bool allowFallback) diff --git a/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs index e83fe1882..313ae29da 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs @@ -94,18 +94,18 @@ public IList SingerIds } [JsonIgnore] - public readonly BindableDictionary TranslateTextBindable = new(); + public readonly BindableDictionary TranslationsBindable = new(); /// - /// Translates + /// Translations /// - public IDictionary Translates + public IDictionary Translations { - get => TranslateTextBindable; + get => TranslationsBindable; set { - TranslateTextBindable.Clear(); - TranslateTextBindable.AddRange(value); + TranslationsBindable.Clear(); + TranslationsBindable.AddRange(value); } } diff --git a/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs b/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs index d6e0c83a0..e232a0dd4 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs @@ -246,13 +246,13 @@ private void initReferenceLyricEvent() SingerIds = lyric.SingerIds; }); - // translates. - bindDictionaryValueChange(e, l => l.TranslateTextBindable, (lyric, config) => + // translations. + bindDictionaryValueChange(e, l => l.TranslationsBindable, (lyric, config) => { if (config is not SyncLyricConfig) return; - Translates = lyric.Translates; + Translations = lyric.Translations; }); // language. diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs index 17f9ac42f..15b0e6f15 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs @@ -254,6 +254,6 @@ private Drawable createTranslateTextBox(Lyric lyric) => { ArgumentNullException.ThrowIfNull(cultureInfo); - return lyric.Translates.TryGetValue(cultureInfo, out string? translate) ? translate : null; + return lyric.Translations.TryGetValue(cultureInfo, out string? translate) ? translate : null; } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs index 151fa9fe0..3b06da87e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs @@ -70,7 +70,7 @@ public LyricPreview() }); preferLanguage.BindValueChanged(e => { - lyric.Translates = createPreviewTranslate(e.NewValue); + lyric.Translations = createPreviewTranslate(e.NewValue); }); void addFont(FontUsage fontUsage) From 331bdb9a559d5f672062c0042df334058689c223 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 4 Jul 2024 01:00:30 +0800 Subject: [PATCH 02/12] Rename in the karaoke beatmap. --- .../BeatmapLanguagesChangeHandlerTest.cs | 18 +++++++++--------- .../CheckBeatmapAvailableTranslatesTest.cs | 2 +- .../Edit/Beatmap/TestSceneTranslateScreen.cs | 2 +- .../Beatmaps/KaraokeBeatmap.cs | 2 +- .../Beatmaps/KaraokeBeatmapConverter.cs | 2 +- .../Beatmaps/KaraokeBeatmapExtension.cs | 2 +- .../Beatmaps/BeatmapLanguagesChangeHandler.cs | 2 +- .../Checks/CheckBeatmapAvailableTranslates.cs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs index 0ee808f21..a5d9791d0 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs @@ -18,7 +18,7 @@ public void TestAdd() { SetUpKaraokeBeatmap(karaokeBeatmap => { - karaokeBeatmap.AvailableTranslates = new List + karaokeBeatmap.AvailableTranslationLanguages = new List { new("zh-TW"), }; @@ -31,9 +31,9 @@ public void TestAdd() AssertKaraokeBeatmap(karaokeBeatmap => { - Assert.AreEqual(2, karaokeBeatmap.AvailableTranslates.Count); - Assert.AreEqual(new CultureInfo("zh-TW"), karaokeBeatmap.AvailableTranslates[0]); - Assert.AreEqual(new CultureInfo("Ja-jp"), karaokeBeatmap.AvailableTranslates[1]); + Assert.AreEqual(2, karaokeBeatmap.AvailableTranslationLanguages.Count); + Assert.AreEqual(new CultureInfo("zh-TW"), karaokeBeatmap.AvailableTranslationLanguages[0]); + Assert.AreEqual(new CultureInfo("Ja-jp"), karaokeBeatmap.AvailableTranslationLanguages[1]); }); } @@ -42,7 +42,7 @@ public void TestRemove() { SetUpKaraokeBeatmap(karaokeBeatmap => { - karaokeBeatmap.AvailableTranslates = new List + karaokeBeatmap.AvailableTranslationLanguages = new List { new("zh-TW"), new("Ja-jp"), @@ -56,8 +56,8 @@ public void TestRemove() AssertKaraokeBeatmap(karaokeBeatmap => { - Assert.AreEqual(1, karaokeBeatmap.AvailableTranslates.Count); - Assert.AreEqual(new CultureInfo("zh-TW"), karaokeBeatmap.AvailableTranslates[0]); + Assert.AreEqual(1, karaokeBeatmap.AvailableTranslationLanguages.Count); + Assert.AreEqual(new CultureInfo("zh-TW"), karaokeBeatmap.AvailableTranslationLanguages[0]); }); } @@ -66,7 +66,7 @@ public void TestIsLanguageContainsTranslate() { SetUpKaraokeBeatmap(karaokeBeatmap => { - karaokeBeatmap.AvailableTranslates = new List + karaokeBeatmap.AvailableTranslationLanguages = new List { new("zh-TW"), new("Ja-jp"), @@ -94,7 +94,7 @@ protected override void SetUpKaraokeBeatmap(Action action) { base.SetUpKaraokeBeatmap(karaokeBeatmap => { - karaokeBeatmap.AvailableTranslates = new List(); + karaokeBeatmap.AvailableTranslationLanguages = new List(); action(karaokeBeatmap); }); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs index da42f9908..b783c7353 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs @@ -122,7 +122,7 @@ private static IBeatmap createTestingBeatmap(List? translateLanguag { Ruleset = new KaraokeRuleset().RulesetInfo, }, - AvailableTranslates = translateLanguage ?? new List(), + AvailableTranslationLanguages = translateLanguage ?? new List(), HitObjects = lyrics?.OfType().ToList() ?? new List(), }; return new EditorBeatmap(karaokeBeatmap); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs index f75e9ece6..b17f408e2 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs @@ -25,7 +25,7 @@ protected override KaraokeBeatmap CreateBeatmap() { var karaokeBeatmap = base.CreateBeatmap(); - karaokeBeatmap.AvailableTranslates = new List + karaokeBeatmap.AvailableTranslationLanguages = new List { new("zh-TW"), new("en-US"), diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmap.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmap.cs index 5d9d2f3c6..ac14e80a1 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmap.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmap.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Karaoke.Beatmaps; public class KaraokeBeatmap : Beatmap { - public IList AvailableTranslates { get; set; } = new List(); + public IList AvailableTranslationLanguages { get; set; } = new List(); public SingerInfo SingerInfo { get; set; } = new(); diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs index 0e6b20262..446f5c76f 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs @@ -33,7 +33,7 @@ protected override Beatmap ConvertBeatmap(IBeatmap original, C if (beatmap is not KaraokeBeatmap karaokeBeatmap) throw new InvalidCastException(nameof(beatmap)); - karaokeBeatmap.AvailableTranslates = propertyDictionary.AvailableTranslates; + karaokeBeatmap.AvailableTranslationLanguages = propertyDictionary.AvailableTranslates; beatmap.HitObjects.Remove(propertyDictionary); return beatmap; diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs index c581c44aa..dff6fd264 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs @@ -17,7 +17,7 @@ public static bool IsScorable(this IBeatmap beatmap) return beatmap is KaraokeBeatmap karaokeBeatmap && karaokeBeatmap.Scorable; } - public static IList AvailableTranslates(this IBeatmap beatmap) => (beatmap as KaraokeBeatmap)?.AvailableTranslates ?? new List(); + public static IList AvailableTranslates(this IBeatmap beatmap) => (beatmap as KaraokeBeatmap)?.AvailableTranslationLanguages ?? new List(); public static bool AnyTranslate(this IBeatmap beatmap) => beatmap.AvailableTranslates().Any(); diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs index cdfecab70..56d57a60f 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs @@ -14,7 +14,7 @@ public partial class BeatmapLanguagesChangeHandler : BeatmapListPropertyChangeHa public IBindableList Languages => Items; protected override IList GetItemsFromBeatmap(KaraokeBeatmap beatmap) - => beatmap.AvailableTranslates; + => beatmap.AvailableTranslationLanguages; protected override void OnItemAdded(CultureInfo item) { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs index 2a1ec0c79..63b5f05ac 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs @@ -23,7 +23,7 @@ public class CheckBeatmapAvailableTranslates : CheckBeatmapProperty GetPropertyFromBeatmap(KaraokeBeatmap karaokeBeatmap) - => karaokeBeatmap.AvailableTranslates; + => karaokeBeatmap.AvailableTranslationLanguages; protected override IEnumerable CheckProperty(IList property) { From 65ef64b7c3080ee99bfbd836870339fa5c3cab64 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 4 Jul 2024 01:06:35 +0800 Subject: [PATCH 03/12] Rename the property in the beatmap namespace. --- .../KaraokeLegacyBeatmapDecoderTest.cs | 24 +++++++++---------- .../Formats/KaraokeLegacyBeatmapDecoder.cs | 24 +++++++++---------- .../Formats/KaraokeLegacyBeatmapEncoder.cs | 18 +++++++------- .../Beatmaps/KaraokeBeatmapConverter.cs | 2 +- .../Beatmaps/KaraokeBeatmapExtension.cs | 4 ++-- .../Objects/LegacyProperties.cs | 2 +- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs index b77d0fdf7..0e1eb16a1 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs @@ -61,7 +61,7 @@ public void TestDecodeBeatmapLyric() } [Test] - public void TestDecodeNote() + public void TestDecodeNotes() { // Karaoke beatmap var beatmap = decodeBeatmap("karaoke-note-samples"); @@ -77,32 +77,32 @@ public void TestDecodeNote() } [Test] - public void TestDecodeTranslate() + public void TestDecodeTranslations() { // Karaoke beatmap var beatmap = decodeBeatmap("karaoke-translate-samples"); - // Get translate - var translates = beatmap.AvailableTranslates(); + // Get translations + var translations = beatmap.AvailableTranslationLanguages(); var lyrics = beatmap.HitObjects.OfType().ToList(); // Check is not null - Assert.IsNotNull(translates); + Assert.IsNotNull(translations); - // Check translate count - Assert.AreEqual(2, translates.Count); + // Check translations count + Assert.AreEqual(2, translations.Count); - // All lyric should have two translates + // All lyric should have two translations Assert.AreEqual(2, lyrics[0].Translations.Count); Assert.AreEqual(2, lyrics[1].Translations.Count); - // Check chinese translate - var chineseLanguageId = translates[0]; + // Check chinese translations + var chineseLanguageId = translations[0]; Assert.AreEqual("卡拉OK", lyrics[0].Translations[chineseLanguageId]); Assert.AreEqual("喜歡", lyrics[1].Translations[chineseLanguageId]); - // Check english translate - var englishLanguageId = translates[1]; + // Check english translations + var englishLanguageId = translations[1]; Assert.AreEqual("karaoke", lyrics[0].Translations[englishLanguageId]); Assert.AreEqual("like it", lyrics[1].Translations[englishLanguageId]); } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs index c71a93775..107f7d757 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs @@ -33,7 +33,7 @@ public KaraokeLegacyBeatmapDecoder(int version = LATEST_VERSION) private readonly IList lrcLines = new List(); private readonly IList noteLines = new List(); - private readonly IList translates = new List(); + private readonly IList translations = new List(); protected override void ParseLine(Beatmap beatmap, Section section, string line) { @@ -62,8 +62,8 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line) } else if (line.ToLower().StartsWith("@tr", StringComparison.Ordinal)) { - // add translate queue - translates.Add(line); + // add translation queue + translations.Add(line); } else if (line.StartsWith("@", StringComparison.Ordinal)) { @@ -91,7 +91,7 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line) } processNotes(beatmap, noteLines); - processTranslate(beatmap, translates); + processTranslations(beatmap, translations); } } @@ -222,20 +222,20 @@ static Tone convertTone(string tone) } } - private void processTranslate(Beatmap beatmap, IEnumerable translateLines) + private void processTranslations(Beatmap beatmap, IEnumerable translationLines) { - var availableTranslates = new List(); + var availableTranslations = new List(); var lyrics = beatmap.HitObjects.OfType().ToList(); - var translations = translateLines.Select(translate => new + var translations = translationLines.Select(translation => new { - key = translate.Split('=').FirstOrDefault()?.Split('[').LastOrDefault()?.Split(']').FirstOrDefault(), - value = translate.Split('=').LastOrDefault() ?? string.Empty, + key = translation.Split('=').FirstOrDefault()?.Split('[').LastOrDefault()?.Split(']').FirstOrDefault(), + value = translation.Split('=').LastOrDefault() ?? string.Empty, }).GroupBy(x => x.key, y => y.value).ToList(); foreach (var translation in translations) { - // get culture and translate + // get culture and translation string? languageCode = translation.Key; if (string.IsNullOrEmpty(languageCode)) continue; @@ -250,12 +250,12 @@ private void processTranslate(Beatmap beatmap, IEnumerable translateLine lyrics[j].Translations.Add(cultureInfo, values[j]); } - availableTranslates.Add(cultureInfo); + availableTranslations.Add(cultureInfo); } var dictionary = new LegacyProperties { - AvailableTranslates = availableTranslates, + AvailableTranslationLanguages = availableTranslations, }; beatmap.HitObjects.Add(dictionary); diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs index 3d754bbba..cd2efa9dc 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapEncoder.cs @@ -17,14 +17,14 @@ public string Encode(Beatmap output) var results = new List { lrcEncoder.Encode(output), - string.Join("\n", encodeNote(output)), - string.Join("\n", encodeTranslate(output)), + string.Join("\n", encodeNotes(output)), + string.Join("\n", encodeTranslations(output)), }; return string.Join("\n\n", results.Where(x => !string.IsNullOrEmpty(x))); } - private IEnumerable encodeNote(Beatmap output) + private IEnumerable encodeNotes(Beatmap output) { var notes = output.HitObjects.OfType().ToList(); var lyrics = output.HitObjects.OfType().ToList(); @@ -61,20 +61,20 @@ static string convertNote(Note note) } } - private IEnumerable encodeTranslate(Beatmap output) + private IEnumerable encodeTranslations(Beatmap output) { - if (!output.AnyTranslate()) + if (!output.AnyTranslation()) yield break; var lyrics = output.HitObjects.OfType().ToList(); - var availableTranslates = output.AvailableTranslates(); + var availableTranslations = output.AvailableTranslationLanguages(); - foreach (var translate in availableTranslates) + foreach (var translation in availableTranslations) { foreach (var lyric in lyrics) { - string translateString = lyric.Translations.TryGetValue(translate, out string? value) ? value : string.Empty; - yield return $"@tr[{translate.Name}]={translateString}"; + string translationString = lyric.Translations.TryGetValue(translation, out string? value) ? value : string.Empty; + yield return $"@tr[{translation.Name}]={translationString}"; } } } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs index 446f5c76f..b38c6762e 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapConverter.cs @@ -33,7 +33,7 @@ protected override Beatmap ConvertBeatmap(IBeatmap original, C if (beatmap is not KaraokeBeatmap karaokeBeatmap) throw new InvalidCastException(nameof(beatmap)); - karaokeBeatmap.AvailableTranslationLanguages = propertyDictionary.AvailableTranslates; + karaokeBeatmap.AvailableTranslationLanguages = propertyDictionary.AvailableTranslationLanguages; beatmap.HitObjects.Remove(propertyDictionary); return beatmap; diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs index dff6fd264..299026342 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapExtension.cs @@ -17,9 +17,9 @@ public static bool IsScorable(this IBeatmap beatmap) return beatmap is KaraokeBeatmap karaokeBeatmap && karaokeBeatmap.Scorable; } - public static IList AvailableTranslates(this IBeatmap beatmap) => (beatmap as KaraokeBeatmap)?.AvailableTranslationLanguages ?? new List(); + public static IList AvailableTranslationLanguages(this IBeatmap beatmap) => (beatmap as KaraokeBeatmap)?.AvailableTranslationLanguages ?? new List(); - public static bool AnyTranslate(this IBeatmap beatmap) => beatmap.AvailableTranslates().Any(); + public static bool AnyTranslation(this IBeatmap beatmap) => beatmap.AvailableTranslationLanguages().Any(); public static float PitchToScale(this IBeatmap beatmap, float pitch) { diff --git a/osu.Game.Rulesets.Karaoke/Objects/LegacyProperties.cs b/osu.Game.Rulesets.Karaoke/Objects/LegacyProperties.cs index 004bc7869..8f71673c2 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/LegacyProperties.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/LegacyProperties.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Objects; // todo: this function is used for legacy karaoke beatmap, will be removed eventually. public class LegacyProperties : KaraokeHitObject { - public IList AvailableTranslates { get; set; } = new List(); + public IList AvailableTranslationLanguages { get; set; } = new List(); public IDictionary Singers { get; set; } = new Dictionary(); } From 38cafc911cd677358d86c330019c4bf684a4d5a9 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 4 Jul 2024 01:08:20 +0800 Subject: [PATCH 04/12] Rename the converter. --- ...anslatesConverterTest.cs => TranslationConverterTest.cs} | 6 +++--- .../{TranslatesConverter.cs => TranslationConverter.cs} | 2 +- .../IO/Serialization/KaraokeJsonSerializableExtensions.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/{TranslatesConverterTest.cs => TranslationConverterTest.cs} (87%) rename osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/{TranslatesConverter.cs => TranslationConverter.cs} (76%) diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/TranslatesConverterTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/TranslationConverterTest.cs similarity index 87% rename from osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/TranslatesConverterTest.cs rename to osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/TranslationConverterTest.cs index 9b9de83e9..2a900fdcd 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/TranslatesConverterTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/TranslationConverterTest.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.IO.Serialization.Converters; -public class TranslatesConverterTest : BaseSingleConverterTest +public class TranslationConverterTest : BaseSingleConverterTest { protected override IEnumerable CreateExtraConverts() { @@ -20,14 +20,14 @@ protected override IEnumerable CreateExtraConverts() [Test] public void TestSerialize() { - var translates = new Dictionary + var translations = new Dictionary { { new CultureInfo("en-US"), "karaoke" }, { new CultureInfo("Ja-jp"), "カラオケ" }, }; const string expected = "[{\"key\":1033,\"value\":\"karaoke\"},{\"key\":1041,\"value\":\"カラオケ\"}]"; - string actual = JsonConvert.SerializeObject(translates, CreateSettings()); + string actual = JsonConvert.SerializeObject(translations, CreateSettings()); Assert.AreEqual(expected, actual); } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/TranslatesConverter.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/TranslationConverter.cs similarity index 76% rename from osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/TranslatesConverter.cs rename to osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/TranslationConverter.cs index beb80782b..75535a738 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/TranslatesConverter.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/TranslationConverter.cs @@ -5,6 +5,6 @@ namespace osu.Game.Rulesets.Karaoke.IO.Serialization.Converters; -public class TranslatesConverter : DictionaryConverter +public class TranslationConverter : DictionaryConverter { } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/KaraokeJsonSerializableExtensions.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/KaraokeJsonSerializableExtensions.cs index 9b05e6c2e..ab3692f21 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/KaraokeJsonSerializableExtensions.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/KaraokeJsonSerializableExtensions.cs @@ -24,7 +24,7 @@ public static JsonSerializerSettings CreateGlobalSettings() globalSetting.Converters.Add(new TimeTagConverter()); globalSetting.Converters.Add(new TimeTagsConverter()); globalSetting.Converters.Add(new ToneConverter()); - globalSetting.Converters.Add(new TranslatesConverter()); + globalSetting.Converters.Add(new TranslationConverter()); globalSetting.Converters.Add(new ReferenceLyricPropertyConfigConverter()); globalSetting.Converters.Add(new LyricConverter()); From a0094065d9ef6b58581e315b243bd5d34e14f03e Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 4 Jul 2024 01:12:05 +0800 Subject: [PATCH 05/12] Rename the translation in the change handler. --- .../BeatmapLanguagesChangeHandlerTest.cs | 6 +++--- ...s => LyricTranslationChangeHandlerTest.cs} | 20 +++++++++---------- .../BeatmapListPropertyChangeHandler.cs | 2 +- .../Beatmaps/BeatmapLanguagesChangeHandler.cs | 2 +- .../IBeatmapLanguagesChangeHandler.cs | 2 +- ...r.cs => ILyricTranslationChangeHandler.cs} | 4 ++-- ...er.cs => LyricTranslationChangeHandler.cs} | 12 +++++------ .../Components/LyricTranslateTextBox.cs | 4 ++-- .../Components/RemoveLanguageButton.cs | 2 +- .../Beatmaps/Translate/TranslateScreen.cs | 6 +++--- 10 files changed, 30 insertions(+), 30 deletions(-) rename osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/{LyricTranslateChangeHandlerTest.cs => LyricTranslationChangeHandlerTest.cs} (74%) rename osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/{ILyricTranslateChangeHandler.cs => ILyricTranslationChangeHandler.cs} (62%) rename osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/{LyricTranslateChangeHandler.cs => LyricTranslationChangeHandler.cs} (69%) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs index a5d9791d0..e8f49d21e 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandlerTest.cs @@ -62,7 +62,7 @@ public void TestRemove() } [Test] - public void TestIsLanguageContainsTranslate() + public void TestIsLanguageContainsTranslation() { SetUpKaraokeBeatmap(karaokeBeatmap => { @@ -85,8 +85,8 @@ public void TestIsLanguageContainsTranslate() TriggerHandlerChanged(c => { - Assert.AreEqual(false, c.IsLanguageContainsTranslate(new CultureInfo("Ja-jp"))); - Assert.AreEqual(true, c.IsLanguageContainsTranslate(new CultureInfo("zh-TW"))); + Assert.AreEqual(false, c.IsLanguageContainsTranslation(new CultureInfo("Ja-jp"))); + Assert.AreEqual(true, c.IsLanguageContainsTranslation(new CultureInfo("zh-TW"))); }); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslationChangeHandlerTest.cs similarity index 74% rename from osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs rename to osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslationChangeHandlerTest.cs index 8cb628e51..f47791931 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslateChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTranslationChangeHandlerTest.cs @@ -10,17 +10,17 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers.Lyrics; -public partial class LyricTranslateChangeHandlerTest : LyricPropertyChangeHandlerTest +public partial class LyricTranslationChangeHandlerTest : LyricPropertyChangeHandlerTest { [Test] - public void TestUpdateTranslateWithNewLanguage() + public void TestUpdateTranslationWithNewLanguage() { PrepareHitObject(() => new Lyric { Text = "カラオケ", }); - TriggerHandlerChanged(c => c.UpdateTranslate(new CultureInfo(17), "からおけ")); + TriggerHandlerChanged(c => c.UpdateTranslation(new CultureInfo(17), "からおけ")); AssertSelectedHitObject(h => { @@ -30,7 +30,7 @@ public void TestUpdateTranslateWithNewLanguage() } [Test] - public void TestUpdateTranslateWithExistLanguage() + public void TestUpdateTranslationWithExistLanguage() { PrepareHitObject(() => new Lyric { @@ -41,7 +41,7 @@ public void TestUpdateTranslateWithExistLanguage() }, }); - TriggerHandlerChanged(c => c.UpdateTranslate(new CultureInfo(17), "karaoke")); + TriggerHandlerChanged(c => c.UpdateTranslation(new CultureInfo(17), "karaoke")); AssertSelectedHitObject(h => { @@ -51,7 +51,7 @@ public void TestUpdateTranslateWithExistLanguage() } [Test] - public void TestUpdateTranslateWithEmptyText() + public void TestUpdateTranslationWithEmptyText() { PrepareHitObject(() => new Lyric { @@ -62,7 +62,7 @@ public void TestUpdateTranslateWithEmptyText() }, }); - TriggerHandlerChanged(c => c.UpdateTranslate(new CultureInfo(17), string.Empty)); + TriggerHandlerChanged(c => c.UpdateTranslation(new CultureInfo(17), string.Empty)); AssertSelectedHitObject(h => { @@ -71,7 +71,7 @@ public void TestUpdateTranslateWithEmptyText() } [Test] - public void TestUpdateTranslateWithNullText() + public void TestUpdateTranslationWithNullText() { PrepareHitObject(() => new Lyric { @@ -82,7 +82,7 @@ public void TestUpdateTranslateWithNullText() }, }); - TriggerHandlerChanged(c => c.UpdateTranslate(new CultureInfo(17), string.Empty)); + TriggerHandlerChanged(c => c.UpdateTranslation(new CultureInfo(17), string.Empty)); AssertSelectedHitObject(h => { @@ -98,6 +98,6 @@ public void TestWithReferenceLyric() Text = "カラオケ", }); - TriggerHandlerChangedWithException(c => c.UpdateTranslate(new CultureInfo(17), "からおけ")); + TriggerHandlerChangedWithException(c => c.UpdateTranslation(new CultureInfo(17), "からおけ")); } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/BeatmapListPropertyChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/BeatmapListPropertyChangeHandler.cs index f3f53cf2b..fad7c5285 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/BeatmapListPropertyChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/BeatmapListPropertyChangeHandler.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers; // todo: not a good design because eventually karaoke beatmap will not have the the field with list type. -// it should be wrap into class (e.g. localizationInfo) with list of translate inside. +// it should be wrap into class (e.g. localizationInfo) with list of translation inside. // so guess this class will be removed eventually. public abstract partial class BeatmapListPropertyChangeHandler : Component { diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs index 56d57a60f..692c7927a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/BeatmapLanguagesChangeHandler.cs @@ -30,6 +30,6 @@ protected override void OnItemRemoved(CultureInfo item) } } - public bool IsLanguageContainsTranslate(CultureInfo cultureInfo) + public bool IsLanguageContainsTranslation(CultureInfo cultureInfo) => Lyrics.Any(x => x.Translations.ContainsKey(cultureInfo)); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/IBeatmapLanguagesChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/IBeatmapLanguagesChangeHandler.cs index 7161dd320..a20f47095 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/IBeatmapLanguagesChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Beatmaps/IBeatmapLanguagesChangeHandler.cs @@ -14,5 +14,5 @@ public interface IBeatmapLanguagesChangeHandler void Remove(CultureInfo culture); - bool IsLanguageContainsTranslate(CultureInfo cultureInfo); + bool IsLanguageContainsTranslation(CultureInfo cultureInfo); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricTranslateChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricTranslationChangeHandler.cs similarity index 62% rename from osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricTranslateChangeHandler.cs rename to osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricTranslationChangeHandler.cs index b4164b66d..b8de262e0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricTranslateChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricTranslationChangeHandler.cs @@ -5,7 +5,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; -public interface ILyricTranslateChangeHandler : ILyricPropertyChangeHandler +public interface ILyricTranslationChangeHandler : ILyricPropertyChangeHandler { - void UpdateTranslate(CultureInfo cultureInfo, string translate); + void UpdateTranslation(CultureInfo cultureInfo, string translation); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslationChangeHandler.cs similarity index 69% rename from osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs rename to osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslationChangeHandler.cs index 1985fee2b..4153de657 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslateChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricTranslationChangeHandler.cs @@ -8,24 +8,24 @@ namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; -public partial class LyricTranslateChangeHandler : LyricPropertyChangeHandler, ILyricTranslateChangeHandler +public partial class LyricTranslationChangeHandler : LyricPropertyChangeHandler, ILyricTranslationChangeHandler { - public void UpdateTranslate(CultureInfo cultureInfo, string translate) + public void UpdateTranslation(CultureInfo cultureInfo, string translation) { CheckExactlySelectedOneHitObject(); PerformOnSelection(lyric => { - // should not save translate if is null or empty or whitespace - if (string.IsNullOrWhiteSpace(translate)) + // should not save translation if is null or empty or whitespace + if (string.IsNullOrWhiteSpace(translation)) { if (lyric.Translations.ContainsKey(cultureInfo)) lyric.Translations.Remove(cultureInfo); } else { - if (!lyric.Translations.TryAdd(cultureInfo, translate)) - lyric.Translations[cultureInfo] = translate; + if (!lyric.Translations.TryAdd(cultureInfo, translation)) + lyric.Translations[cultureInfo] = translation; } }); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs index a3c5ef44c..e15755ac5 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs @@ -18,7 +18,7 @@ public partial class LyricTranslateTextBox : OsuTextBox private EditorBeatmap beatmap { get; set; } = null!; [Resolved] - private ILyricTranslateChangeHandler lyricTranslateChangeHandler { get; set; } = null!; + private ILyricTranslationChangeHandler lyricTranslationChangeHandler { get; set; } = null!; [Resolved] private ITranslateInfoProvider translateInfoProvider { get; set; } = null!; @@ -54,7 +54,7 @@ public LyricTranslateTextBox(Lyric lyric) if (cultureInfo == null) return; - lyricTranslateChangeHandler.UpdateTranslate(cultureInfo, text); + lyricTranslationChangeHandler.UpdateTranslation(cultureInfo, text); }; } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs index 1d90299bc..afc8670f4 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs @@ -27,7 +27,7 @@ public RemoveLanguageButton() Icon = FontAwesome.Solid.Trash; Action = () => { - if (beatmapLanguagesChangeHandler.IsLanguageContainsTranslate(currentLanguage.Value)) + if (beatmapLanguagesChangeHandler.IsLanguageContainsTranslation(currentLanguage.Value)) { dialogOverlay.Push(new DeleteLanguagePopupDialog(currentLanguage.Value, isOk => { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs index fc2520b46..51cf27c8b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs @@ -17,14 +17,14 @@ public partial class TranslateScreen : BeatmapEditorRoundedScreen [Cached(typeof(IBeatmapLanguagesChangeHandler))] private readonly BeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler; - [Cached(typeof(ILyricTranslateChangeHandler))] - private readonly LyricTranslateChangeHandler lyricTranslateChangeHandler; + [Cached(typeof(ILyricTranslationChangeHandler))] + private readonly LyricTranslationChangeHandler lyricTranslationChangeHandler; public TranslateScreen() : base(KaraokeBeatmapEditorScreenMode.Translate) { AddInternal(beatmapLanguagesChangeHandler = new BeatmapLanguagesChangeHandler()); - AddInternal(lyricTranslateChangeHandler = new LyricTranslateChangeHandler()); + AddInternal(lyricTranslationChangeHandler = new LyricTranslationChangeHandler()); } [BackgroundDependencyLoader] From e92a57b615bc4d5d3eb7989112313d31d402e02d Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 22:46:15 +0800 Subject: [PATCH 06/12] Rename the wording in the check namespace. --- ... CheckBeatmapAvailableTranslationsTest.cs} | 68 +++++++++---------- ...eTest.cs => CheckLyricTranslationsTest.cs} | 6 +- ...s => CheckBeatmapAvailableTranslations.cs} | 44 ++++++------ ...Translate.cs => CheckLyricTranslations.cs} | 8 +-- .../Edit/KaraokeBeatmapVerifier.cs | 4 +- .../Edit/Components/Issues/IssueIcon.cs | 4 +- 6 files changed, 67 insertions(+), 67 deletions(-) rename osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/{CheckBeatmapAvailableTranslatesTest.cs => CheckBeatmapAvailableTranslationsTest.cs} (54%) rename osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/{CheckLyricTranslateTest.cs => CheckLyricTranslationsTest.cs} (91%) rename osu.Game.Rulesets.Karaoke/Edit/Checks/{CheckBeatmapAvailableTranslates.cs => CheckBeatmapAvailableTranslations.cs} (55%) rename osu.Game.Rulesets.Karaoke/Edit/Checks/{CheckLyricTranslate.cs => CheckLyricTranslations.cs} (83%) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslationsTest.cs similarity index 54% rename from osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs rename to osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslationsTest.cs index b783c7353..87b124ed9 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslatesTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckBeatmapAvailableTranslationsTest.cs @@ -12,12 +12,12 @@ using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Screens.Edit; using osu.Game.Tests.Beatmaps; -using static osu.Game.Rulesets.Karaoke.Edit.Checks.CheckBeatmapAvailableTranslates; +using static osu.Game.Rulesets.Karaoke.Edit.Checks.CheckBeatmapAvailableTranslations; namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Checks; [TestFixture] -public class CheckBeatmapAvailableTranslatesTest : BeatmapPropertyCheckTest +public class CheckBeatmapAvailableTranslationsTest : BeatmapPropertyCheckTest { [Test] public void TestNoLyricAndNoLanguage() @@ -32,8 +32,8 @@ public void TestNoLyricAndNoLanguage() public void TestNoLyricButHaveLanguage() { // test no lyric and have language. (should not show alert) - var translateLanguages = new List { new("Ja-jp") }; - var beatmap = createTestingBeatmap(translateLanguages, null); + var translationLanguages = new List { new("Ja-jp") }; + var beatmap = createTestingBeatmap(translationLanguages, null); AssertOk(getContext(beatmap)); } @@ -49,72 +49,72 @@ public void TestHaveLyricButNoLanguage() } [Test] - public void TestEveryLyricContainsTranslate() + public void TestEveryLyricContainsTranslation() { - var translateLanguages = new List { new("Ja-jp") }; - var beatmap = createTestingBeatmap(translateLanguages, new[] + var translationLanguages = new List { new("Ja-jp") }; + var beatmap = createTestingBeatmap(translationLanguages, new[] { - createLyric(new CultureInfo("Ja-jp"), "translate1"), - createLyric(new CultureInfo("Ja-jp"), "translate2"), + createLyric(new CultureInfo("Ja-jp"), "translation1"), + createLyric(new CultureInfo("Ja-jp"), "translation2"), }); AssertOk(getContext(beatmap)); } [Test] - public void TestCheckMissingTranslate() + public void TestCheckMissingTranslation() { - // no lyric with translate string. (should have issue) - var translateLanguages = new List { new("Ja-jp") }; - var beatmap = createTestingBeatmap(translateLanguages, new[] + // no lyric with translation string. (should have issue) + var translationLanguages = new List { new("Ja-jp") }; + var beatmap = createTestingBeatmap(translationLanguages, new[] { createLyric(), createLyric(), }); - AssertNotOk(getContext(beatmap)); + AssertNotOk(getContext(beatmap)); - // no lyric with translate string. (should have issue) - var beatmap2 = createTestingBeatmap(translateLanguages, new[] + // no lyric with translation string. (should have issue) + var beatmap2 = createTestingBeatmap(translationLanguages, new[] { createLyric(new CultureInfo("Ja-jp")), createLyric(), }); - AssertNotOk(getContext(beatmap2)); + AssertNotOk(getContext(beatmap2)); - // no lyric with translate string. (should have issue) - var beatmap3 = createTestingBeatmap(translateLanguages, new[] + // no lyric with translation string. (should have issue) + var beatmap3 = createTestingBeatmap(translationLanguages, new[] { createLyric(new CultureInfo("Ja-jp")), createLyric(new CultureInfo("Ja-jp"), string.Empty), }); - AssertNotOk(getContext(beatmap3)); + AssertNotOk(getContext(beatmap3)); } [Test] - public void TestCheckMissingPartialTranslate() + public void TestCheckMissingPartialTranslation() { - // some lyric with translate string. (should have issue) - var translateLanguages = new List { new("Ja-jp") }; - var beatmap4 = createTestingBeatmap(translateLanguages, new[] + // some lyric with translation string. (should have issue) + var translationLanguages = new List { new("Ja-jp") }; + var beatmap4 = createTestingBeatmap(translationLanguages, new[] { - createLyric(new CultureInfo("Ja-jp"), "translate1"), + createLyric(new CultureInfo("Ja-jp"), "translation1"), createLyric(new CultureInfo("Ja-jp")), }); - AssertNotOk(getContext(beatmap4)); + AssertNotOk(getContext(beatmap4)); } [Test] - public void TestCheckContainsNotListedLanguage() + public void TestCheckTranslationNotInListedLanguage() { - // lyric translate not listed. (should have issue) + // lyric translation not listed. (should have issue) var beatmap6 = createTestingBeatmap(null, new[] { - createLyric(new CultureInfo("en-US"), "translate1"), + createLyric(new CultureInfo("en-US"), "translation1"), }); - AssertNotOk(getContext(beatmap6)); + AssertNotOk(getContext(beatmap6)); } - private static IBeatmap createTestingBeatmap(List? translateLanguage, IEnumerable? lyrics) + private static IBeatmap createTestingBeatmap(List? translationLanguages, IEnumerable? lyrics) { var karaokeBeatmap = new KaraokeBeatmap { @@ -122,7 +122,7 @@ private static IBeatmap createTestingBeatmap(List? translateLanguag { Ruleset = new KaraokeRuleset().RulesetInfo, }, - AvailableTranslationLanguages = translateLanguage ?? new List(), + AvailableTranslationLanguages = translationLanguages ?? new List(), HitObjects = lyrics?.OfType().ToList() ?? new List(), }; return new EditorBeatmap(karaokeBeatmap); @@ -131,13 +131,13 @@ private static IBeatmap createTestingBeatmap(List? translateLanguag private static BeatmapVerifierContext getContext(IBeatmap beatmap) => new(beatmap, new TestWorkingBeatmap(beatmap)); - private static Lyric createLyric(CultureInfo? cultureInfo = null, string translate = null!) + private static Lyric createLyric(CultureInfo? cultureInfo = null, string translation = null!) { var lyric = new Lyric(); if (cultureInfo == null) return lyric; - lyric.Translations.Add(cultureInfo, translate); + lyric.Translations.Add(cultureInfo, translation); return lyric; } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslationsTest.cs similarity index 91% rename from osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs rename to osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslationsTest.cs index 6365fac00..3c8ee3f4a 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslateTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Checks/CheckLyricTranslationsTest.cs @@ -7,13 +7,13 @@ using osu.Game.Rulesets.Karaoke.Edit.Checks; using osu.Game.Rulesets.Karaoke.Edit.Checks.Issues; using osu.Game.Rulesets.Karaoke.Objects; -using static osu.Game.Rulesets.Karaoke.Edit.Checks.CheckLyricTranslate; +using static osu.Game.Rulesets.Karaoke.Edit.Checks.CheckLyricTranslations; namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Checks; -public class CheckLyricTranslateTest : HitObjectCheckTest +public class CheckLyricTranslationsTest : HitObjectCheckTest { - [TestCase("translate")] + [TestCase("translation")] [TestCase("k")] // not limit min size for now. [TestCase("翻譯")] // not limit language. public void TestCheck(string text) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslations.cs similarity index 55% rename from osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs rename to osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslations.cs index 63b5f05ac..99885bd2e 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslates.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapAvailableTranslations.cs @@ -11,15 +11,15 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Checks; -public class CheckBeatmapAvailableTranslates : CheckBeatmapProperty, Lyric> +public class CheckBeatmapAvailableTranslations : CheckBeatmapProperty, Lyric> { protected override string Description => "Beatmap with invalid localization info."; public override IEnumerable PossibleTemplates => new IssueTemplate[] { - new IssueTemplateMissingTranslate(this), - new IssueTemplateMissingPartialTranslate(this), - new IssueTemplateContainsNotListedLanguage(this), + new IssueTemplateMissingTranslation(this), + new IssueTemplateMissingPartialTranslation(this), + new IssueTemplateTranslationNotInListedLanguage(this), }; protected override IList GetPropertyFromBeatmap(KaraokeBeatmap karaokeBeatmap) @@ -36,37 +36,37 @@ protected override IEnumerable CheckHitObjects(IList propert if (hitObject.Count == 0) yield break; - // check if some translate is missing or empty. + // check if some translations is missing or empty. foreach (var language in property) { - var notTranslateLyrics = hitObject.Where(x => !x.Translations.ContainsKey(language) || string.IsNullOrWhiteSpace(x.Translations[language])).ToArray(); + var missingTranslationLyrics = hitObject.Where(x => !x.Translations.ContainsKey(language) || string.IsNullOrWhiteSpace(x.Translations[language])).ToArray(); - if (notTranslateLyrics.Length == hitObject.Count) + if (missingTranslationLyrics.Length == hitObject.Count) { - yield return new IssueTemplateMissingTranslate(this).Create(notTranslateLyrics, language); + yield return new IssueTemplateMissingTranslation(this).Create(missingTranslationLyrics, language); } - else if (notTranslateLyrics.Any()) + else if (missingTranslationLyrics.Any()) { - yield return new IssueTemplateMissingPartialTranslate(this).Create(notTranslateLyrics, language); + yield return new IssueTemplateMissingPartialTranslation(this).Create(missingTranslationLyrics, language); } } - // should check is lyric contains translate that is not listed in beatmap. + // should check is lyric contains translation that is not listed in beatmap. // if got this issue, then it's a bug. - var allTranslateLanguageInLyric = hitObject.SelectMany(x => x.Translations.Keys).Distinct(); - var languageNotListInBeatmap = allTranslateLanguageInLyric.Except(property); + var allTranslationLanguageInLyric = hitObject.SelectMany(x => x.Translations.Keys).Distinct(); + var languageNotListInBeatmap = allTranslationLanguageInLyric.Except(property); foreach (var language in languageNotListInBeatmap) { - var notTranslateLyrics = hitObject.Where(x => !x.Translations.ContainsKey(language)); + var notContainsTranslationLyrics = hitObject.Where(x => !x.Translations.ContainsKey(language)); - yield return new IssueTemplateContainsNotListedLanguage(this).Create(notTranslateLyrics, language); + yield return new IssueTemplateTranslationNotInListedLanguage(this).Create(notContainsTranslationLyrics, language); } } - public class IssueTemplateMissingTranslate : IssueTemplate + public class IssueTemplateMissingTranslation : IssueTemplate { - public IssueTemplateMissingTranslate(ICheck check) + public IssueTemplateMissingTranslation(ICheck check) : base(check, IssueType.Problem, "There are no lyric translations for this language.") { } @@ -75,9 +75,9 @@ public Issue Create(IEnumerable hitObjects, CultureInfo cultureInfo) => new(hitObjects, this, cultureInfo); } - public class IssueTemplateMissingPartialTranslate : IssueTemplate + public class IssueTemplateMissingPartialTranslation : IssueTemplate { - public IssueTemplateMissingPartialTranslate(ICheck check) + public IssueTemplateMissingPartialTranslation(ICheck check) : base(check, IssueType.Problem, "Some lyrics in this language are missing translations.") { } @@ -86,10 +86,10 @@ public Issue Create(IEnumerable hitObjects, CultureInfo cultureInfo) => new(hitObjects, this, cultureInfo); } - public class IssueTemplateContainsNotListedLanguage : IssueTemplate + public class IssueTemplateTranslationNotInListedLanguage : IssueTemplate { - public IssueTemplateContainsNotListedLanguage(ICheck check) - : base(check, IssueType.Problem, "Seems some translate language is not listed, plz contact developer to fix that bug.") + public IssueTemplateTranslationNotInListedLanguage(ICheck check) + : base(check, IssueType.Problem, "Seems some translation language is not listed in the beatmap, please contact developer to fix that bug.") { } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslations.cs similarity index 83% rename from osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs rename to osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslations.cs index 0d0aa3c5c..8fa0e6875 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslate.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Checks/CheckLyricTranslations.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Checks; -public class CheckLyricTranslate : CheckHitObjectProperty +public class CheckLyricTranslations : CheckHitObjectProperty { protected override string Description => "Lyric with invalid translations."; @@ -20,11 +20,11 @@ public class CheckLyricTranslate : CheckHitObjectProperty protected override IEnumerable Check(Lyric lyric) { - var translates = lyric.Translations; + var translations = lyric.Translations; - foreach ((var language, string translate) in translates) + foreach ((var language, string translation) in translations) { - if (string.IsNullOrWhiteSpace(translate)) + if (string.IsNullOrWhiteSpace(translation)) yield return new IssueTemplateEmptyText(this).Create(lyric, language); } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/KaraokeBeatmapVerifier.cs b/osu.Game.Rulesets.Karaoke/Edit/KaraokeBeatmapVerifier.cs index 53b7677b1..1132d98b7 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/KaraokeBeatmapVerifier.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/KaraokeBeatmapVerifier.cs @@ -13,7 +13,7 @@ public class KaraokeBeatmapVerifier : IBeatmapVerifier { private readonly List checks = new() { - new CheckBeatmapAvailableTranslates(), + new CheckBeatmapAvailableTranslations(), new CheckBeatmapClassicStageInfo(), new CheckBeatmapNoteInfo(), new CheckBeatmapPageInfo(), @@ -24,7 +24,7 @@ public class KaraokeBeatmapVerifier : IBeatmapVerifier new CheckLyricText(), new CheckLyricTime(), new CheckLyricTimeTag(), - new CheckLyricTranslate(), + new CheckLyricTranslations(), new CheckNoteReferenceLyric(), new CheckNoteText(), new CheckNoteTime(), diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Issues/IssueIcon.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Issues/IssueIcon.cs index 4f0191594..5a7321ac8 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Issues/IssueIcon.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Issues/IssueIcon.cs @@ -65,7 +65,7 @@ private static IconUsage getIconByIssueTemplate(IssueTemplate issueTemplate) private static IconUsage getIconUsageByCheck(ICheck check) => check switch { - CheckBeatmapAvailableTranslates => FontAwesome.Solid.Language, + CheckBeatmapAvailableTranslations => FontAwesome.Solid.Language, CheckBeatmapClassicStageInfo => FontAwesome.Solid.AlignLeft, CheckBeatmapNoteInfo => FontAwesome.Solid.Microphone, CheckBeatmapPageInfo => FontAwesome.Solid.Pager, @@ -76,7 +76,7 @@ private static IconUsage getIconUsageByCheck(ICheck check) => CheckLyricText => FontAwesome.Solid.TextHeight, CheckLyricTime => FontAwesome.Solid.Times, CheckLyricTimeTag => FontAwesome.Solid.Tag, - CheckLyricTranslate => FontAwesome.Solid.Language, + CheckLyricTranslations => FontAwesome.Solid.Language, CheckNoteReferenceLyric => FontAwesome.Solid.Link, CheckNoteText => FontAwesome.Solid.Link, CheckNoteTime => FontAwesome.Solid.Times, From 472735d5e4893eaf2bdc146515e805aa298ea611 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 23:01:59 +0800 Subject: [PATCH 07/12] Rename in the translation editor. --- ...reen.cs => TestSceneTranslationsScreen.cs} | 6 ++-- .../Edit/Beatmaps/KaraokeBeatmapEditor.cs | 4 +-- .../Components/CreateNewLanguageButton.cs | 2 +- .../Components/LanguageDropdown.cs | 2 +- .../Components/LyricTranslationTextBox.cs} | 10 +++--- .../Components/PreviewLyricSpriteText.cs} | 6 ++-- .../Components/RemoveLanguageButton.cs | 2 +- .../DeleteLanguagePopupDialog.cs | 4 +-- .../ITranslationInfoProvider.cs} | 6 ++-- .../TranslationEditSection.cs} | 32 +++++++++---------- .../TranslationScreen.cs} | 20 ++++++------ 11 files changed, 47 insertions(+), 47 deletions(-) rename osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/{TestSceneTranslateScreen.cs => TestSceneTranslationsScreen.cs} (86%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate => Translations}/Components/CreateNewLanguageButton.cs (98%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate => Translations}/Components/LanguageDropdown.cs (96%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate/Components/LyricTranslateTextBox.cs => Translations/Components/LyricTranslationTextBox.cs} (86%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate/Components/TranslateLyricSpriteText.cs => Translations/Components/PreviewLyricSpriteText.cs} (77%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate => Translations}/Components/RemoveLanguageButton.cs (98%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate => Translations}/DeleteLanguagePopupDialog.cs (94%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate/ITranslateInfoProvider.cs => Translations/ITranslationInfoProvider.cs} (70%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate/TranslateEditSection.cs => Translations/TranslationEditSection.cs} (91%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/{Translate/TranslateScreen.cs => Translations/TranslationScreen.cs} (78%) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslationsScreen.cs similarity index 86% rename from osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs rename to osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslationsScreen.cs index b17f408e2..79dea569b 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/TestSceneTranslationsScreen.cs @@ -10,16 +10,16 @@ using osu.Game.Overlays; using osu.Game.Rulesets.Karaoke.Beatmaps; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations; namespace osu.Game.Rulesets.Karaoke.Tests.Screens.Edit.Beatmap; [TestFixture] -public partial class TestSceneTranslateScreen : BeatmapEditorScreenTestScene +public partial class TestSceneTranslationsScreen : BeatmapEditorScreenTestScene { protected override Container Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; - protected override TranslateScreen CreateEditorScreen() => new(); + protected override TranslationScreen CreateEditorScreen() => new(); protected override KaraokeBeatmap CreateBeatmap() { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs index 752b8a8b3..f6a065084 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs @@ -18,7 +18,7 @@ using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Pages; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Singers; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations; using osu.Game.Rulesets.Karaoke.Skinning.Fonts; using osu.Game.Screens.Edit.Components.Menus; @@ -86,7 +86,7 @@ protected override GenericEditorScreen GenerateS { KaraokeBeatmapEditorScreenMode.Lyric => new LyricEditorScreen(), KaraokeBeatmapEditorScreenMode.Singer => new SingerScreen(), - KaraokeBeatmapEditorScreenMode.Translate => new TranslateScreen(), + KaraokeBeatmapEditorScreenMode.Translate => new TranslationScreen(), KaraokeBeatmapEditorScreenMode.Page => new PageScreen(), _ => throw new InvalidOperationException("Editor menu bar switched to an unsupported mode"), }; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/CreateNewLanguageButton.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/CreateNewLanguageButton.cs similarity index 98% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/CreateNewLanguageButton.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/CreateNewLanguageButton.cs index 0ecbce7e3..c9042342e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/CreateNewLanguageButton.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/CreateNewLanguageButton.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Components.UserInterfaceV2; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate.Components; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components; public partial class CreateNewLanguageButton : IconButton, IHasPopover { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LanguageDropdown.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/LanguageDropdown.cs similarity index 96% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LanguageDropdown.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/LanguageDropdown.cs index f616f2cc2..2ef037cbf 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LanguageDropdown.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/LanguageDropdown.cs @@ -6,7 +6,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Karaoke.Utils; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate.Components; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components; public partial class LanguageDropdown : OsuDropdown { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/LyricTranslationTextBox.cs similarity index 86% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/LyricTranslationTextBox.cs index e15755ac5..8deb4febe 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/LyricTranslateTextBox.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/LyricTranslationTextBox.cs @@ -10,9 +10,9 @@ using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Screens.Edit; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate.Components; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components; -public partial class LyricTranslateTextBox : OsuTextBox +public partial class LyricTranslationTextBox : OsuTextBox { [Resolved] private EditorBeatmap beatmap { get; set; } = null!; @@ -21,13 +21,13 @@ public partial class LyricTranslateTextBox : OsuTextBox private ILyricTranslationChangeHandler lyricTranslationChangeHandler { get; set; } = null!; [Resolved] - private ITranslateInfoProvider translateInfoProvider { get; set; } = null!; + private ITranslationInfoProvider translationInfoProvider { get; set; } = null!; private readonly IBindable currentLanguage = new Bindable(); private readonly Lyric lyric; - public LyricTranslateTextBox(Lyric lyric) + public LyricTranslationTextBox(Lyric lyric) { this.lyric = lyric; @@ -36,7 +36,7 @@ public LyricTranslateTextBox(Lyric lyric) var cultureInfo = v.NewValue; // disable and clear text box if contains no language in language list. - Text = cultureInfo != null ? translateInfoProvider.GetLyricTranslate(lyric, cultureInfo) : null; + Text = cultureInfo != null ? translationInfoProvider.GetLyricTranslation(lyric, cultureInfo) : null; ScheduleAfterChildren(() => { Current.Disabled = cultureInfo == null; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/TranslateLyricSpriteText.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/PreviewLyricSpriteText.cs similarity index 77% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/TranslateLyricSpriteText.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/PreviewLyricSpriteText.cs index 7ca5934c3..11864be12 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/TranslateLyricSpriteText.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/PreviewLyricSpriteText.cs @@ -6,11 +6,11 @@ using osu.Game.Rulesets.Karaoke.Graphics.Sprites; using osu.Game.Rulesets.Karaoke.Objects; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate.Components; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components; -public partial class TranslateLyricSpriteText : DrawableLyricSpriteText, IHasCustomTooltip +public partial class PreviewLyricSpriteText : DrawableLyricSpriteText, IHasCustomTooltip { - public TranslateLyricSpriteText(Lyric hitObject) + public PreviewLyricSpriteText(Lyric hitObject) : base(hitObject) { TooltipContent = hitObject; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/RemoveLanguageButton.cs similarity index 98% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/RemoveLanguageButton.cs index afc8670f4..9efc98e0b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/Components/RemoveLanguageButton.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/Components/RemoveLanguageButton.cs @@ -9,7 +9,7 @@ using osu.Game.Overlays; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate.Components; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components; public partial class RemoveLanguageButton : IconButton { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/DeleteLanguagePopupDialog.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/DeleteLanguagePopupDialog.cs similarity index 94% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/DeleteLanguagePopupDialog.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/DeleteLanguagePopupDialog.cs index 0bb5c40d2..707ad025a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/DeleteLanguagePopupDialog.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/DeleteLanguagePopupDialog.cs @@ -7,7 +7,7 @@ using osu.Game.Overlays.Dialog; using osu.Game.Rulesets.Karaoke.Utils; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations; public partial class DeleteLanguagePopupDialog : PopupDialog { @@ -15,7 +15,7 @@ public DeleteLanguagePopupDialog(CultureInfo currentLanguage, Action okAct { Icon = FontAwesome.Regular.TrashAlt; HeaderText = $"Confirm deletion of language {CultureInfoUtils.GetLanguageDisplayText(currentLanguage)}?"; - BodyText = "It will also remove the translate."; + BodyText = "It will also remove the translations."; Buttons = new PopupDialogButton[] { new PopupDialogOkButton diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/ITranslateInfoProvider.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/ITranslationInfoProvider.cs similarity index 70% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/ITranslateInfoProvider.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/ITranslationInfoProvider.cs index 3459d312e..09675710d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/ITranslateInfoProvider.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/ITranslationInfoProvider.cs @@ -4,9 +4,9 @@ using System.Globalization; using osu.Game.Rulesets.Karaoke.Objects; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations; -public interface ITranslateInfoProvider +public interface ITranslationInfoProvider { - string? GetLyricTranslate(Lyric lyric, CultureInfo cultureInfo); + string? GetLyricTranslation(Lyric lyric, CultureInfo cultureInfo); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationEditSection.cs similarity index 91% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationEditSection.cs index 15b0e6f15..2c25d126a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateEditSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationEditSection.cs @@ -16,12 +16,12 @@ using osu.Game.Rulesets.Karaoke.Graphics.Shapes; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Utils; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate.Components; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations; -[Cached(typeof(ITranslateInfoProvider))] -public partial class TranslateEditSection : Container, ITranslateInfoProvider +[Cached(typeof(ITranslationInfoProvider))] +public partial class TranslationEditSection : Container, ITranslationInfoProvider { private const int row_height = 50; private const int column_spacing = 10; @@ -39,7 +39,7 @@ public partial class TranslateEditSection : Container, ITranslateInfoProvider private readonly IBindableList bindableLyrics = new BindableList(); - public TranslateEditSection() + public TranslationEditSection() { Padding = new MarginPadding(10); @@ -51,7 +51,7 @@ public TranslateEditSection() new Dimension(GridSizeMode.Absolute, column_spacing), new Dimension(), }; - GridContainer translateGrid; + GridContainer translationsGrid; Child = new FillFlowContainer { @@ -161,9 +161,9 @@ public TranslateEditSection() }, }, }, - translateGrid = new GridContainer + translationsGrid = new GridContainer { - Name = "Translates", + Name = "Translations", ColumnDimensions = columnDimensions, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -182,8 +182,8 @@ public TranslateEditSection() bindableLyrics.BindCollectionChanged((_, _) => { // just re-create all the view, lazy to save the performance in here. - translateGrid.RowDimensions = bindableLyrics.Select(_ => new Dimension(GridSizeMode.Absolute, row_height)).ToArray(); - translateGrid.Content = createContent(); + translationsGrid.RowDimensions = bindableLyrics.Select(_ => new Dimension(GridSizeMode.Absolute, row_height)).ToArray(); + translationsGrid.Content = createContent(); }); } @@ -208,7 +208,7 @@ private Drawable[][] createContent() Empty(), createPreviewSpriteText(x), Empty(), - createTranslateTextBox(x), + createTranslationTextBox(x), }; }).ToArray(); } @@ -227,7 +227,7 @@ private Drawable createTimeDrawable(Lyric lyric) } private Drawable createPreviewSpriteText(Lyric lyric) => - new TranslateLyricSpriteText(lyric) + new PreviewLyricSpriteText(lyric) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -240,8 +240,8 @@ private Drawable createPreviewSpriteText(Lyric lyric) => BottomTextFont = new FontUsage(size: 10), }; - private Drawable createTranslateTextBox(Lyric lyric) => - new LyricTranslateTextBox(lyric) + private Drawable createTranslationTextBox(Lyric lyric) => + new LyricTranslationTextBox(lyric) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -250,10 +250,10 @@ private Drawable createTranslateTextBox(Lyric lyric) => CommitOnFocusLost = true, }; - public string? GetLyricTranslate(Lyric lyric, CultureInfo cultureInfo) + public string? GetLyricTranslation(Lyric lyric, CultureInfo cultureInfo) { ArgumentNullException.ThrowIfNull(cultureInfo); - return lyric.Translations.TryGetValue(cultureInfo, out string? translate) ? translate : null; + return lyric.Translations.TryGetValue(cultureInfo, out string? translation) ? translation : null; } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs similarity index 78% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs index 51cf27c8b..e7a44045c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs @@ -10,9 +10,9 @@ using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translate; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations; -public partial class TranslateScreen : BeatmapEditorRoundedScreen +public partial class TranslationScreen : BeatmapEditorRoundedScreen { [Cached(typeof(IBeatmapLanguagesChangeHandler))] private readonly BeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler; @@ -20,7 +20,7 @@ public partial class TranslateScreen : BeatmapEditorRoundedScreen [Cached(typeof(ILyricTranslationChangeHandler))] private readonly LyricTranslationChangeHandler lyricTranslationChangeHandler; - public TranslateScreen() + public TranslationScreen() : base(KaraokeBeatmapEditorScreenMode.Translate) { AddInternal(beatmapLanguagesChangeHandler = new BeatmapLanguagesChangeHandler()); @@ -32,11 +32,11 @@ private void load() { Add(new SectionsContainer { - FixedHeader = new TranslateScreenHeader(), + FixedHeader = new TranslationScreenHeader(), RelativeSizeAxes = Axes.Both, Children = new Container[] { - new TranslateEditSection + new TranslationEditSection { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -45,15 +45,15 @@ private void load() }); } - internal partial class TranslateScreenHeader : OverlayHeader + internal partial class TranslationScreenHeader : OverlayHeader { - protected override OverlayTitle CreateTitle() => new TranslateScreenTitle(); + protected override OverlayTitle CreateTitle() => new TranslationScreenTitle(); - private partial class TranslateScreenTitle : OverlayTitle + private partial class TranslationScreenTitle : OverlayTitle { - public TranslateScreenTitle() + public TranslationScreenTitle() { - Title = "translate"; + Title = "translation"; Description = "create translation of your beatmap"; Icon = OsuIcon.Online; } From 7dd04c2dc57df7429270a5b2884330ae7a50ab91 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 23:03:11 +0800 Subject: [PATCH 08/12] Rename the enum. --- .../Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs | 2 +- .../Screens/Edit/Beatmaps/KaraokeBeatmapEditorScreenMode.cs | 4 ++-- .../Screens/Edit/Beatmaps/Translations/TranslationScreen.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs index f6a065084..ab6bddfb4 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditor.cs @@ -86,7 +86,7 @@ protected override GenericEditorScreen GenerateS { KaraokeBeatmapEditorScreenMode.Lyric => new LyricEditorScreen(), KaraokeBeatmapEditorScreenMode.Singer => new SingerScreen(), - KaraokeBeatmapEditorScreenMode.Translate => new TranslationScreen(), + KaraokeBeatmapEditorScreenMode.Translation => new TranslationScreen(), KaraokeBeatmapEditorScreenMode.Page => new PageScreen(), _ => throw new InvalidOperationException("Editor menu bar switched to an unsupported mode"), }; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditorScreenMode.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditorScreenMode.cs index ec0e6b348..ffece83f3 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditorScreenMode.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/KaraokeBeatmapEditorScreenMode.cs @@ -13,8 +13,8 @@ public enum KaraokeBeatmapEditorScreenMode [Description("Singer")] Singer, - [Description("Translate")] - Translate, + [Description("Translation")] + Translation, [Description("Page")] Page, diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs index e7a44045c..ab6e2e2a9 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translations/TranslationScreen.cs @@ -21,7 +21,7 @@ public partial class TranslationScreen : BeatmapEditorRoundedScreen private readonly LyricTranslationChangeHandler lyricTranslationChangeHandler; public TranslationScreen() - : base(KaraokeBeatmapEditorScreenMode.Translate) + : base(KaraokeBeatmapEditorScreenMode.Translation) { AddInternal(beatmapLanguagesChangeHandler = new BeatmapLanguagesChangeHandler()); AddInternal(lyricTranslationChangeHandler = new LyricTranslationChangeHandler()); From 917cf3781540bb4f5428ed26d4be2e093a24cc45 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 23:05:39 +0800 Subject: [PATCH 09/12] Rename in the screen namespace. --- .../Settings/Previews/Gameplay/LyricPreview.cs | 14 +++++++------- .../Screens/Settings/Sections/ConfigSection.cs | 2 +- ...TranslateSettings.cs => TranslationSettings.cs} | 6 +++--- .../Sections/Graphics/LyricFontSettings.cs | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) rename osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/{TranslateSettings.cs => TranslationSettings.cs} (82%) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs index 3b06da87e..0fb173cf0 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs @@ -25,7 +25,7 @@ public partial class LyricPreview : SettingsSubsectionPreview private readonly Bindable mainFont = new(); private readonly Bindable rubyFont = new(); private readonly Bindable romanisationFont = new(); - private readonly Bindable translateFont = new(); + private readonly Bindable translationFont = new(); private readonly Bindable preferLanguage = new(); [Resolved] @@ -64,13 +64,13 @@ public LyricPreview() { addFont(e.NewValue); }); - translateFont.BindValueChanged(e => + translationFont.BindValueChanged(e => { addFont(e.NewValue); }); preferLanguage.BindValueChanged(e => { - lyric.Translations = createPreviewTranslate(e.NewValue); + lyric.Translations = createPreviewTranslation(e.NewValue); }); void addFont(FontUsage fontUsage) @@ -95,7 +95,7 @@ private void load(FontManager fontManager, IRenderer renderer, KaraokeRulesetCon config.BindWith(KaraokeRulesetSetting.MainFont, mainFont); config.BindWith(KaraokeRulesetSetting.RubyFont, rubyFont); config.BindWith(KaraokeRulesetSetting.RomanisationFont, romanisationFont); - config.BindWith(KaraokeRulesetSetting.TranslateFont, translateFont); + config.BindWith(KaraokeRulesetSetting.TranslateFont, translationFont); config.BindWith(KaraokeRulesetSetting.PreferLanguage, preferLanguage); } @@ -143,9 +143,9 @@ private Lyric createPreviewLyric() EffectApplier = new PreviewLyricEffectApplier(), }; - private IDictionary createPreviewTranslate(CultureInfo cultureInfo) + private IDictionary createPreviewTranslation(CultureInfo cultureInfo) { - string translate = cultureInfo.Name switch + string translation = cultureInfo.Name switch { "ja" or "Ja-jp" => "カラオケ", "zh-Hant" or "zh-TW" => "卡拉OK", @@ -154,7 +154,7 @@ private IDictionary createPreviewTranslate(CultureInfo cult return new Dictionary { - { cultureInfo, translate }, + { cultureInfo, translation }, }; } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs index 391fae121..fa61bcaaa 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs @@ -23,7 +23,7 @@ public ConfigSection() { new GeneralSettings(), new NoteSettings(), - new TranslateSettings(), + new TranslationSettings(), new PracticeSettings(), }; } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs similarity index 82% rename from osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.cs rename to osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs index a795993e8..2cd9eb64c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs @@ -11,9 +11,9 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Settings.Sections.Gameplay; -public partial class TranslateSettings : KaraokeSettingsSubsection +public partial class TranslationSettings : KaraokeSettingsSubsection { - protected override LocalisableString Header => "Translate"; + protected override LocalisableString Header => "Translation"; public override SettingsSubsectionPreview CreatePreview() => new LyricPreview(); @@ -25,7 +25,7 @@ private void load() new SettingsLanguage { LabelText = "Prefer language", - TooltipText = "Select prefer translate language.", + TooltipText = "Select prefer translation.", Current = Config.GetBindable(KaraokeRulesetSetting.PreferLanguage), }, }; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs index 752f86327..be67e2c70 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs @@ -58,12 +58,12 @@ private void load() }, new SettingsFont { - LabelText = "Translate font", + LabelText = "Translation font", Current = Config.GetBindable(KaraokeRulesetSetting.TranslateFont), }, new SettingsCheckbox { - LabelText = "Force use default translate font.", + LabelText = "Force use default translation font.", TooltipText = "Force use default font even has customize font in skin or beatmap.", Current = Config.GetBindable(KaraokeRulesetSetting.ForceUseDefaultTranslateFont), }, From 3010dd60d17ac3c45e803f9818e65839f9d7db94 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 23:07:15 +0800 Subject: [PATCH 10/12] Rename in the config namespace. --- .../Skinning/TestSceneLyric.cs | 2 +- .../KaraokeRulesetConfigManager.cs | 22 +++++++++---------- .../Mods/KaraokeModTranslation.cs | 2 +- .../Objects/Drawables/DrawableLyric.cs | 2 +- .../Previews/Gameplay/LyricPreview.cs | 4 ++-- .../Sections/Gameplay/TranslationSettings.cs | 2 +- .../Sections/Graphics/LyricFontSettings.cs | 4 ++-- .../Skinning/Elements/LyricFontInfo.cs | 6 ++--- .../UI/KaraokePlayfieldAdjustmentContainer.cs | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs index fe0d9737f..e18e192b5 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs @@ -33,7 +33,7 @@ public TestSceneLyric() private void load() { var config = Dependencies.Get(); - config.SetValue(KaraokeRulesetSetting.PreferLanguage, cultureInfo); + config.SetValue(KaraokeRulesetSetting.PreferTranslationLanguage, cultureInfo); } private Drawable testSingle(double timeOffset = 0) diff --git a/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetConfigManager.cs b/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetConfigManager.cs index a41c01084..35333375a 100644 --- a/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetConfigManager.cs @@ -33,8 +33,8 @@ protected override void InitialiseDefaults() SetDefault(KaraokeRulesetSetting.NoteAlpha, 1, 0.2, 1, 0.01); SetDefault(KaraokeRulesetSetting.LyricAlpha, 1, 0.2, 1, 0.01); - // Translate - SetDefault(KaraokeRulesetSetting.PreferLanguage, new CultureInfo("en-US")); + // Translation + SetDefault(KaraokeRulesetSetting.PreferTranslationLanguage, new CultureInfo("en-US")); // Pitch SetDefault(KaraokeRulesetSetting.OverridePitchAtGameplay, false); @@ -61,8 +61,8 @@ protected override void InitialiseDefaults() SetDefault(KaraokeRulesetSetting.RomanisationFont, new FontUsage("Torus", 20, "Bold"), 8f, 48f); SetDefault(KaraokeRulesetSetting.RomanisationMargin, 0, 0, 20); SetDefault(KaraokeRulesetSetting.ForceUseDefaultFont, false); - SetDefault(KaraokeRulesetSetting.TranslateFont, new FontUsage("Torus", 18, "Bold"), 10f, 48f); - SetDefault(KaraokeRulesetSetting.ForceUseDefaultTranslateFont, false); + SetDefault(KaraokeRulesetSetting.TranslationFont, new FontUsage("Torus", 18, "Bold"), 10f, 48f); + SetDefault(KaraokeRulesetSetting.ForceUseDefaultTranslationFont, false); SetDefault(KaraokeRulesetSetting.NoteFont, new FontUsage("Torus", 12, "Bold"), 10f, 32f); SetDefault(KaraokeRulesetSetting.ForceUseDefaultNoteFont, false); } @@ -71,7 +71,7 @@ protected override void AddBindable(KaraokeRulesetSetting lookup, Bin { switch (lookup) { - case KaraokeRulesetSetting.PreferLanguage: + case KaraokeRulesetSetting.PreferTranslationLanguage: // todo : need to hve a default value here because it will cause error if object is null while saving. base.AddBindable(lookup, new BindableCultureInfo(bindable.Value as CultureInfo)); break; @@ -79,7 +79,7 @@ protected override void AddBindable(KaraokeRulesetSetting lookup, Bin case KaraokeRulesetSetting.MainFont: case KaraokeRulesetSetting.RubyFont: case KaraokeRulesetSetting.RomanisationFont: - case KaraokeRulesetSetting.TranslateFont: + case KaraokeRulesetSetting.TranslationFont: case KaraokeRulesetSetting.NoteFont: base.AddBindable(lookup, new BindableFontUsage(TypeUtils.ChangeType(bindable.Value))); break; @@ -111,7 +111,7 @@ protected BindableFontUsage SetDefault(KaraokeRulesetSetting setting, FontUsage new TrackedSetting(KaraokeRulesetSetting.ScrollTime, v => new SettingDescription(v, "Scroll Time", $"{v}ms")), new TrackedSetting(KaraokeRulesetSetting.DisplayNoteRubyText, b => new SettingDescription(b, "Toggle display", b ? "Show" : "Hide")), new TrackedSetting(KaraokeRulesetSetting.ShowCursor, b => new SettingDescription(b, "Cursor display", b ? "Show" : "Hide")), - new TrackedSetting(KaraokeRulesetSetting.PreferLanguage, c => new SettingDescription(c, "Translate language", CultureInfoUtils.GetLanguageDisplayText(c))), + new TrackedSetting(KaraokeRulesetSetting.PreferTranslationLanguage, c => new SettingDescription(c, "Translation language", CultureInfoUtils.GetLanguageDisplayText(c))), new TrackedSetting(KaraokeRulesetSetting.MicrophoneDevice, d => new SettingDescription(d, "Change to the new microphone device", d)), }; } @@ -126,8 +126,8 @@ public enum KaraokeRulesetSetting NoteAlpha, LyricAlpha, - // Translate - PreferLanguage, + // Translation + PreferTranslationLanguage, // Pitch OverridePitchAtGameplay, @@ -154,8 +154,8 @@ public enum KaraokeRulesetSetting RomanisationFont, RomanisationMargin, ForceUseDefaultFont, - TranslateFont, - ForceUseDefaultTranslateFont, + TranslationFont, + ForceUseDefaultTranslationFont, NoteFont, ForceUseDefaultNoteFont, } diff --git a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModTranslation.cs b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModTranslation.cs index f3caec1a6..bfc5bd350 100644 --- a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModTranslation.cs +++ b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModTranslation.cs @@ -33,7 +33,7 @@ public void ApplyToDrawableHitObject(DrawableHitObject drawable) static CultureInfo? getPreferLanguage(IReadOnlyDependencyContainer dependencyContainer) { var config = dependencyContainer.Get(); - return config.Get(KaraokeRulesetSetting.PreferLanguage); + return config.Get(KaraokeRulesetSetting.PreferTranslationLanguage); } } } diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs index 47d42c26c..6b2f44acb 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs @@ -77,7 +77,7 @@ private void load(KaraokeRulesetConfigManager? config) config.BindWith(KaraokeRulesetSetting.RubyMargin, rubyMarginBindable); config.BindWith(KaraokeRulesetSetting.RomanisationFont, romanisationFontUsageBindable); config.BindWith(KaraokeRulesetSetting.RomanisationMargin, romanisationMarginBindable); - config.BindWith(KaraokeRulesetSetting.TranslateFont, translateFontUsageBindable); + config.BindWith(KaraokeRulesetSetting.TranslationFont, translateFontUsageBindable); } mainFontUsageBindable.BindValueChanged(_ => updateLyricFontInfo()); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs index 0fb173cf0..b8cf2efec 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs @@ -95,8 +95,8 @@ private void load(FontManager fontManager, IRenderer renderer, KaraokeRulesetCon config.BindWith(KaraokeRulesetSetting.MainFont, mainFont); config.BindWith(KaraokeRulesetSetting.RubyFont, rubyFont); config.BindWith(KaraokeRulesetSetting.RomanisationFont, romanisationFont); - config.BindWith(KaraokeRulesetSetting.TranslateFont, translationFont); - config.BindWith(KaraokeRulesetSetting.PreferLanguage, preferLanguage); + config.BindWith(KaraokeRulesetSetting.TranslationFont, translationFont); + config.BindWith(KaraokeRulesetSetting.PreferTranslationLanguage, preferLanguage); } protected override void Dispose(bool isDisposing) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs index 2cd9eb64c..f837b6eda 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslationSettings.cs @@ -26,7 +26,7 @@ private void load() { LabelText = "Prefer language", TooltipText = "Select prefer translation.", - Current = Config.GetBindable(KaraokeRulesetSetting.PreferLanguage), + Current = Config.GetBindable(KaraokeRulesetSetting.PreferTranslationLanguage), }, }; } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs index be67e2c70..ddd3dfbe7 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs @@ -59,13 +59,13 @@ private void load() new SettingsFont { LabelText = "Translation font", - Current = Config.GetBindable(KaraokeRulesetSetting.TranslateFont), + Current = Config.GetBindable(KaraokeRulesetSetting.TranslationFont), }, new SettingsCheckbox { LabelText = "Force use default translation font.", TooltipText = "Force use default font even has customize font in skin or beatmap.", - Current = Config.GetBindable(KaraokeRulesetSetting.ForceUseDefaultTranslateFont), + Current = Config.GetBindable(KaraokeRulesetSetting.ForceUseDefaultTranslationFont), }, }; } diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs b/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs index 45b694691..7c2e8dd26 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs @@ -118,7 +118,7 @@ public void ApplyTo(Drawable d) // Apply translate font. drawableLyric.ApplyToTranslateText(text => { - text.Font = getFont(KaraokeRulesetSetting.TranslateFont); + text.Font = getFont(KaraokeRulesetSetting.TranslationFont); }); FontUsage getFont(KaraokeRulesetSetting setting, FontUsage? skinFont = null) @@ -141,8 +141,8 @@ bool forceUseDefaultFont() case KaraokeRulesetSetting.RomanisationFont: return config?.Get(KaraokeRulesetSetting.ForceUseDefaultFont) ?? false; - case KaraokeRulesetSetting.TranslateFont: - return config?.Get(KaraokeRulesetSetting.ForceUseDefaultTranslateFont) ?? false; + case KaraokeRulesetSetting.TranslationFont: + return config?.Get(KaraokeRulesetSetting.ForceUseDefaultTranslationFont) ?? false; default: throw new InvalidOperationException(nameof(setting)); diff --git a/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs index 07929458c..0fcc9e523 100644 --- a/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs @@ -33,7 +33,7 @@ private void load(FontManager fontManager, IRenderer renderer, KaraokeRulesetCon manager.Get(KaraokeRulesetSetting.MainFont), manager.Get(KaraokeRulesetSetting.RubyFont), manager.Get(KaraokeRulesetSetting.RomanisationFont), - manager.Get(KaraokeRulesetSetting.TranslateFont), + manager.Get(KaraokeRulesetSetting.TranslationFont), manager.Get(KaraokeRulesetSetting.NoteFont), }; From 93c217a8b1d6f3a194474924e06f8f0d583edfc1 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 23:13:49 +0800 Subject: [PATCH 11/12] Rename the remaining part. --- .../Graphics/UserInterfaceV2/FontSelector.cs | 2 +- .../KaraokeSettingsSubsectionStrings.cs | 4 +- .../Objects/Drawables/DrawableLyric.cs | 46 +++++++++---------- .../Skinning/Elements/LyricFontInfo.cs | 4 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs index 310a7303a..43975fcf3 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs @@ -327,7 +327,7 @@ private void load(OsuColour colours) _ => throw new ArgumentOutOfRangeException(nameof(fontFormat)), }; - // todo : might apply translate. + // todo : might apply translation. badgeText.Text = fontFormat.ToString(); } } diff --git a/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs b/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs index 5d3cb67ac..7f59b7e64 100644 --- a/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs +++ b/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs @@ -44,9 +44,9 @@ public static class KaraokeSettingsSubsectionStrings public static LocalisableString PreferLanguage => new TranslatableString(getKey(@"prefer_language"), @"Prefer language"); /// - /// "Select prefer translate language." + /// "Select prefer translation language." /// - public static LocalisableString PreferLanguageTooltip => new TranslatableString(getKey(@"prefer_language_tooltip"), @"Select prefer translate language."); + public static LocalisableString PreferTranslationLanguageTooltip => new TranslatableString(getKey(@"prefer_language_tooltip"), @"Select prefer translation language."); /// /// "Microphone device" diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs index 6b2f44acb..b0783acf0 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs @@ -22,9 +22,9 @@ namespace osu.Game.Rulesets.Karaoke.Objects.Drawables; public partial class DrawableLyric : DrawableKaraokeHitObject { private Container lyricPieces = null!; - private OsuSpriteText translateText = null!; + private OsuSpriteText translationText = null!; - private readonly BindableBool useTranslateBindable = new(); + private readonly BindableBool useTranslationBindable = new(); private readonly Bindable preferLanguageBindable = new(); private readonly Bindable mainFontUsageBindable = new(); @@ -32,10 +32,10 @@ public partial class DrawableLyric : DrawableKaraokeHitObject private readonly Bindable rubyMarginBindable = new(); private readonly Bindable romanisationFontUsageBindable = new(); private readonly Bindable romanisationMarginBindable = new(); - private readonly Bindable translateFontUsageBindable = new(); + private readonly Bindable translationFontUsageBindable = new(); private readonly IBindableDictionary singersBindable = new BindableDictionary(); - private readonly BindableDictionary translateTextBindable = new(); + private readonly BindableDictionary translationTextBindable = new(); public event Action? OnLyricStart; public event Action? OnLyricEnd; @@ -61,14 +61,14 @@ private void load(KaraokeRulesetConfigManager? config) { AutoSizeAxes = Axes.Both, }); - AddInternal(translateText = new OsuSpriteText + AddInternal(translationText = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, }); - useTranslateBindable.BindValueChanged(_ => applyTranslate(), true); - preferLanguageBindable.BindValueChanged(_ => applyTranslate(), true); + useTranslationBindable.BindValueChanged(_ => applyTranslation(), true); + preferLanguageBindable.BindValueChanged(_ => applyTranslation(), true); if (config != null) { @@ -77,7 +77,7 @@ private void load(KaraokeRulesetConfigManager? config) config.BindWith(KaraokeRulesetSetting.RubyMargin, rubyMarginBindable); config.BindWith(KaraokeRulesetSetting.RomanisationFont, romanisationFontUsageBindable); config.BindWith(KaraokeRulesetSetting.RomanisationMargin, romanisationMarginBindable); - config.BindWith(KaraokeRulesetSetting.TranslationFont, translateFontUsageBindable); + config.BindWith(KaraokeRulesetSetting.TranslationFont, translationFontUsageBindable); } mainFontUsageBindable.BindValueChanged(_ => updateLyricFontInfo()); @@ -85,11 +85,11 @@ private void load(KaraokeRulesetConfigManager? config) rubyMarginBindable.BindValueChanged(_ => updateLyricFontInfo()); romanisationFontUsageBindable.BindValueChanged(_ => updateLyricFontInfo()); romanisationMarginBindable.BindValueChanged(_ => updateLyricFontInfo()); - translateFontUsageBindable.BindValueChanged(_ => updateLyricFontInfo()); + translationFontUsageBindable.BindValueChanged(_ => updateLyricFontInfo()); // property in hitobject. singersBindable.BindCollectionChanged((_, _) => { updateFontStyle(); }); - translateTextBindable.BindCollectionChanged((_, _) => { applyTranslate(); }); + translationTextBindable.BindCollectionChanged((_, _) => { applyTranslation(); }); } public void ChangeDisplayType(LyricDisplayType lyricDisplayType) @@ -104,11 +104,11 @@ public void ChangeDisplayProperty(LyricDisplayProperty lyricDisplayProperty) public void ChangePreferTranslationLanguage(CultureInfo? language) { - if (language != null && translateTextBindable.TryGetValue(language, out string? translate)) - translateText.Text = translate; + if (language != null && translationTextBindable.TryGetValue(language, out string? translation)) + translationText.Text = translation; else { - translateText.Text = string.Empty; + translationText.Text = string.Empty; } } @@ -121,7 +121,7 @@ protected override void OnApply() ApplySkin(CurrentSkin, false); singersBindable.BindTo(HitObject.SingersBindable); - translateTextBindable.BindTo(HitObject.TranslationsBindable); + translationTextBindable.BindTo(HitObject.TranslationsBindable); } protected override void OnFree() @@ -129,7 +129,7 @@ protected override void OnFree() base.OnFree(); singersBindable.UnbindFrom(HitObject.SingersBindable); - translateTextBindable.UnbindFrom(HitObject.TranslationsBindable); + translationTextBindable.UnbindFrom(HitObject.TranslationsBindable); } protected override void ApplySkin(ISkinSource skin, bool allowFallback) @@ -164,19 +164,19 @@ private void updateLyricFontInfo() lyricFontInfo?.ApplyTo(this); } - private void applyTranslate() + private void applyTranslation() { var language = preferLanguageBindable.Value; - bool needTranslate = useTranslateBindable.Value; + bool useTranslation = useTranslationBindable.Value; - if (!needTranslate || language == null) + if (!useTranslation || language == null) { - translateText.Text = string.Empty; + translationText.Text = string.Empty; } else { - if (translateTextBindable.TryGetValue(language, out string? translate)) - translateText.Text = translate; + if (translationTextBindable.TryGetValue(language, out string? translation)) + translationText.Text = translation; } } @@ -216,8 +216,8 @@ public void ApplyToLyricPieces(Action action) action?.Invoke(lyricPiece); } - public void ApplyToTranslateText(Action action) + public void ApplyToTranslationText(Action action) { - action?.Invoke(translateText); + action?.Invoke(translationText); } } diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs b/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs index 7c2e8dd26..a14ceb652 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs @@ -115,8 +115,8 @@ public void ApplyTo(Drawable d) l.BottomTextMargin = RomanisationMargin; }); - // Apply translate font. - drawableLyric.ApplyToTranslateText(text => + // Apply translation font. + drawableLyric.ApplyToTranslationText(text => { text.Font = getFont(KaraokeRulesetSetting.TranslationFont); }); From 27b10396d102f5156bcffad939aca2fbcf7e42c3 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 5 Jul 2024 23:17:50 +0800 Subject: [PATCH 12/12] Rename the static resource. --- .../Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs | 2 +- .../Beatmaps/TestSceneBeatmapInfoWedge.cs | 2 +- ...ke-translate-samples.osu => karaoke-translation-samples.osu} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename osu.Game.Rulesets.Karaoke.Tests/Resources/Testing/Beatmaps/{karaoke-translate-samples.osu => karaoke-translation-samples.osu} (100%) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs index 0e1eb16a1..52fb001b1 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs @@ -80,7 +80,7 @@ public void TestDecodeNotes() public void TestDecodeTranslations() { // Karaoke beatmap - var beatmap = decodeBeatmap("karaoke-translate-samples"); + var beatmap = decodeBeatmap("karaoke-translation-samples"); // Get translations var translations = beatmap.AvailableTranslationLanguages(); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestSceneBeatmapInfoWedge.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestSceneBeatmapInfoWedge.cs index c386d961d..84147a0a0 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestSceneBeatmapInfoWedge.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestSceneBeatmapInfoWedge.cs @@ -39,7 +39,7 @@ protected override void LoadComplete() [TestCase("karaoke-file-samples")] [TestCase("karaoke-file-samples-without-note")] [TestCase("karaoke-note-samples")] - [TestCase("karaoke-translate-samples")] + [TestCase("karaoke-translation-samples")] public void TestNullBeatmap(string fileName) { using var resStream = TestResources.OpenBeatmapResource(fileName); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Resources/Testing/Beatmaps/karaoke-translate-samples.osu b/osu.Game.Rulesets.Karaoke.Tests/Resources/Testing/Beatmaps/karaoke-translation-samples.osu similarity index 100% rename from osu.Game.Rulesets.Karaoke.Tests/Resources/Testing/Beatmaps/karaoke-translate-samples.osu rename to osu.Game.Rulesets.Karaoke.Tests/Resources/Testing/Beatmaps/karaoke-translation-samples.osu