From 2a344dfbd84ff84e9d79a3c5fc172756bf153954 Mon Sep 17 00:00:00 2001 From: "Ch. (Chanhwi Choi)" Date: Thu, 3 Jan 2019 08:38:26 +0900 Subject: [PATCH] =?UTF-8?q?adds=20ko-KR=20=E3=81=AA=20to=20=E3=81=AB?= =?UTF-8?q?=E3=82=83=20(#3820)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * adds ko-KR な to にゃ - this only take considers pre-composed "Hangul Syllables", not composable area "Hangul Jamo" which are not used commonly - 56 is '냐' - '나' * replace magic number as suggested --- src/models/note.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/models/note.ts b/src/models/note.ts index f33497075..f2fb39051 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -372,7 +372,14 @@ export const pack = async ( //#endregion if (_note.user.isCat && _note.text) { - _note.text = _note.text.replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ'); + _note.text = (_note.text + // ja-JP + .replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ') + // ko-KR + .replace(/[나-낳]/g, (match: string) => String.fromCharCode( + match.codePointAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0) + )) + ); } if (!opts.skipHide) {