This commit is contained in:
Ljzd PRO 2024-09-17 19:35:36 +00:00 committed by GitHub
commit 4cc928dcdb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -15,6 +15,7 @@
- Fix: 縦横比が極端なカスタム絵文字を表示する際にレイアウトが崩れる箇所があるのを修正
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/725)
- Fix: 設定変更時のリロード確認ダイアログが複数個表示されることがある問題を修正
- Fix: ERROR CODE: APP_IMPORT on iOS <= 16.3 (SyntaxError: Invalid regular expression: invalid group specifier name)
### Server
- Fix: アンテナの書き込み時にキーワードが与えられなかった場合のエラーをApiErrorとして投げるように

View File

@ -3,9 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
const enRegex1 = /(?<=n)a/gi;
const enRegex2 = /(?<=morn)ing/gi;
const enRegex3 = /(?<=every)one/gi;
const koRegex1 = /[나-낳]/g;
const koRegex2 = /(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm;
const koRegex3 = /(야(?=\?))|(야$)|(야(?= ))/gm;
@ -15,9 +12,12 @@ export function nyaize(text: string): string {
// ja-JP
.replaceAll('な', 'にゃ').replaceAll('ナ', 'ニャ').replaceAll('ナ', 'ニャ')
// en-US
.replace(enRegex1, x => x === 'A' ? 'YA' : 'ya')
.replace(enRegex2, x => x === 'ING' ? 'YAN' : 'yan')
.replace(enRegex3, x => x === 'ONE' ? 'NYAN' : 'nyan')
.replaceAll('na', 'nya')
.replaceAll('NA', 'NYA')
.replaceAll('morning', 'mornyan')
.replaceAll('MORNING', 'MORNYAN')
.replaceAll('everyone', 'everynyan')
.replaceAll('EVERYONE', 'EVERYNYAN')
// ko-KR
.replace(koRegex1, match => !isNaN(match.charCodeAt(0)) ? String.fromCharCode(
match.charCodeAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0),