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
This commit is contained in:
Ch. (Chanhwi Choi) 2019-01-03 08:38:26 +09:00 committed by syuilo
parent 866d4cd59a
commit 2a344dfbd8
1 changed files with 8 additions and 1 deletions

View File

@ -372,7 +372,14 @@ export const pack = async (
//#endregion //#endregion
if (_note.user.isCat && _note.text) { 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) { if (!opts.skipHide) {