diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d4fba3674..15a33932a 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -932,6 +932,7 @@ assign: "アサイン" unassign: "アサインを解除" color: "色" manageCustomEmojis: "カスタム絵文字の管理" +youCannotCreateAnymore: "これ以上作成することはできません。" _role: new: "ロールの作成" diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index 15d725def..891d598d8 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -4,6 +4,7 @@ import { Component, markRaw, Ref, ref, defineAsyncComponent } from 'vue'; import { EventEmitter } from 'eventemitter3'; import insertTextAtCursor from 'insert-text-at-cursor'; import * as Misskey from 'misskey-js'; +import { i18n } from './i18n'; import MkPostFormDialog from '@/components/MkPostFormDialog.vue'; import MkWaitingDialog from '@/components/MkWaitingDialog.vue'; import { MenuItem } from '@/types/menu'; @@ -17,9 +18,16 @@ export const apiWithDialog = (( ) => { const promise = api(endpoint, data, token); promiseDialog(promise, null, (err) => { + let title = null; + let text = err.message + '\n' + (err as any).id; + if (err.code.startsWith('TOO_MANY')) { + title = i18n.ts.youCannotCreateAnymore; + text = `${i18n.ts.error}: ${err.id}`; + } alert({ type: 'error', - text: err.message + '\n' + (err as any).id, + title, + text, }); });