From bc5c6ae200f4e4003871c823121f3deeac2da41b Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 29 Nov 2020 15:36:51 +0900 Subject: [PATCH] change to customze nuget and fix japanese's detection --- .../Generator/Languages/LanguageDetectorTest.cs | 14 +++----------- .../Edit/Generator/Languages/LanguageDetector.cs | 10 +--------- .../osu.Game.Rulesets.Karaoke.csproj | 2 +- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Edit/Generator/Languages/LanguageDetectorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Edit/Generator/Languages/LanguageDetectorTest.cs index d9e221abf..b68cfeaf5 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Edit/Generator/Languages/LanguageDetectorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Edit/Generator/Languages/LanguageDetectorTest.cs @@ -13,7 +13,9 @@ public class LanguageDetectorTest { [TestCase("花火大会", "zh-CN")] [TestCase("花火大會", "zh-TW")] - [TestCase("Testing", "en-US")] + [TestCase("Testing", "en")] + [TestCase("ハナビ", "ja")] + [TestCase("はなび", "ja")] public void TestDetectLanguage(string text, string language) { var detector = new LanguageDetector(generageConfig()); @@ -21,16 +23,6 @@ public void TestDetectLanguage(string text, string language) Assert.AreEqual(result, new CultureInfo(language)); } - [Ignore("Japanese text not supported now")] - [TestCase("ハナビ", "ja-jp")] - [TestCase("はなび", "ja-jp")] - public void TestJapaneseLanguage(string text, string language) - { - // todo : should fix this dictionary to add all Hiragana and Katakana - // https://github.com/pdonald/language-detection/blob/master/LanguageDetection/Profiles/ja - TestDetectLanguage(text, language); - } - private LanguageDetectorConfig generageConfig() { return new LanguageDetectorConfig(); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Generator/Languages/LanguageDetector.cs b/osu.Game.Rulesets.Karaoke/Edit/Generator/Languages/LanguageDetector.cs index 3e3fde3f3..208a102a0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Generator/Languages/LanguageDetector.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Generator/Languages/LanguageDetector.cs @@ -33,15 +33,7 @@ public CultureInfo DetectLanguage(Lyric lyric) if (languageCode == null) return null; - // make some language conversion here - switch (languageCode) - { - // todo : need to think about is this needed? - case "en": - return new CultureInfo("en-US"); - default: - return new CultureInfo(languageCode); - } + return new CultureInfo(languageCode); } } } diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index 199ce8ba3..5538f1189 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -11,7 +11,7 @@ - +