1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Improved support for Japanese, Chinese, Korean search queries (also applies to Goto Anything)

This commit is contained in:
Laurent Cozic
2019-04-03 07:46:41 +01:00
parent 252d937405
commit 72b36522e8
4 changed files with 44 additions and 10 deletions

View File

@ -267,8 +267,10 @@ const REGEX_CHINESE = /[\u4e00-\u9fff]|[\u3400-\u4dbf]|[\u{20000}-\u{2a6df}]|[\u
const REGEX_KOREAN = /[\uac00-\ud7af]|[\u1100-\u11ff]|[\u3130-\u318f]|[\ua960-\ua97f]|[\ud7b0-\ud7ff]/;
function scriptType(s) {
if (REGEX_JAPANESE.test(s)) return 'ja';
// A string entirely with Chinese character will be detected as Japanese too
// so Chinese detection must go first.
if (REGEX_CHINESE.test(s)) return 'zh';
if (REGEX_JAPANESE.test(s)) return 'ja';
if (REGEX_KOREAN.test(s)) return 'ko';
return 'en';
}