diff --git a/WindowTranslator/Modules/Ocr/OcrBufferFilter.cs b/WindowTranslator/Modules/Ocr/OcrBufferFilter.cs index ea71a6b2..5487a30d 100644 --- a/WindowTranslator/Modules/Ocr/OcrBufferFilter.cs +++ b/WindowTranslator/Modules/Ocr/OcrBufferFilter.cs @@ -69,7 +69,7 @@ public async IAsyncEnumerable ExecutePreTranslate(IAsyncEnumerable + /// CJK文字(日本語・中国語・韓国語等)が含まれているかを判定する + /// + private static bool ContainsCjk(string text) + { + foreach (var c in text) + { + // 平仮名・片仮名・CJK統合漢字・ハングル音節・CJK互換漢字 + if ((c >= '\u3040' && c <= '\u9FFF') || + (c >= '\uAC00' && c <= '\uD7AF') || + (c >= '\uF900' && c <= '\uFAFF')) + { + return true; + } + } + return false; + } + private static bool IsAllSameChar(string text) { ReadOnlySpan chars = text;