summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCh. (Chanhwi Choi) <ccwpc@hanmail.net>2019-01-03 08:38:26 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-01-03 08:38:26 +0900
commit2a344dfbd84ff84e9d79a3c5fc172756bf153954 (patch)
tree26864365cd192f533bf80089f0e9af9f77244215 /src
parentUpdate vue-i18n requirement from 8.3.2 to 8.6.0 (#3821) (diff)
downloadsharkey-2a344dfbd84ff84e9d79a3c5fc172756bf153954.tar.gz
sharkey-2a344dfbd84ff84e9d79a3c5fc172756bf153954.tar.bz2
sharkey-2a344dfbd84ff84e9d79a3c5fc172756bf153954.zip
adds ko-KR な to にゃ (#3820)
* 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
Diffstat (limited to 'src')
-rw-r--r--src/models/note.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/models/note.ts b/src/models/note.ts
index f334970750..f2fb39051b 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) {