From 6dc4f3d8a1b81e1c1943194adf4fed091e3cecda Mon Sep 17 00:00:00 2001 From: naskya <m@naskya.net> Date: Wed, 3 Apr 2024 13:36:09 +0900 Subject: [PATCH] refactor (client, minor): replace i18n.t with i18n.ts --- packages/client/src/components/MkDonation.vue | 2 +- .../client/src/components/MkFollowButton.vue | 2 +- packages/client/src/components/MkInfo.vue | 2 +- .../client/src/components/MkModalPageWindow.vue | 2 +- packages/client/src/components/MkModalWindow.vue | 6 +++--- packages/client/src/components/MkNote.vue | 6 +++--- packages/client/src/components/MkPollEditor.vue | 2 +- packages/client/src/components/MkPostForm.vue | 6 +++--- packages/client/src/components/MkWidgets.vue | 2 +- packages/client/src/pages/follow-requests.vue | 4 ++-- packages/client/src/pages/gallery/edit.vue | 2 +- .../src/pages/messaging/messaging-room.form.vue | 4 ++-- packages/client/src/pages/my-groups/group.vue | 2 +- packages/client/src/pages/my-lists/list.vue | 2 +- .../page-editor/page-editor.script-block.vue | 2 +- .../client/src/pages/page-editor/page-editor.vue | 2 +- packages/client/src/pages/settings/profile.vue | 4 ++-- packages/client/src/ui/deck.vue | 8 ++++---- packages/client/src/ui/universal.vue | 16 ++++++++-------- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/packages/client/src/components/MkDonation.vue b/packages/client/src/components/MkDonation.vue index f213867d65..1c13754c13 100644 --- a/packages/client/src/components/MkDonation.vue +++ b/packages/client/src/components/MkDonation.vue @@ -49,7 +49,7 @@ <button class="_button" :class="$style.close" - :aria-label="i18n.t('close')" + :aria-label="i18n.ts.close" @click="close" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/components/MkFollowButton.vue b/packages/client/src/components/MkFollowButton.vue index da621518ab..ffe1de72af 100644 --- a/packages/client/src/components/MkFollowButton.vue +++ b/packages/client/src/components/MkFollowButton.vue @@ -123,7 +123,7 @@ async function onClick() { if (isBlocking.value) { const { canceled } = await os.confirm({ type: "warning", - text: i18n.t("unblockConfirm"), + text: i18n.ts.unblockConfirm, }); if (canceled) return; diff --git a/packages/client/src/components/MkInfo.vue b/packages/client/src/components/MkInfo.vue index 1247903a97..4fb41ba3dc 100644 --- a/packages/client/src/components/MkInfo.vue +++ b/packages/client/src/components/MkInfo.vue @@ -7,7 +7,7 @@ v-if="closeable" v-tooltip="i18n.ts.close" class="_buttonIcon close" - :aria-label="i18n.t('close')" + :aria-label="i18n.ts.close" @click.stop="close" > <i :class="iconClass('ph-x')"></i> diff --git a/packages/client/src/components/MkModalPageWindow.vue b/packages/client/src/components/MkModalPageWindow.vue index bd44379001..e9c8136ae4 100644 --- a/packages/client/src/components/MkModalPageWindow.vue +++ b/packages/client/src/components/MkModalPageWindow.vue @@ -28,7 +28,7 @@ </span> <button class="_button" - :aria-label="i18n.t('close')" + :aria-label="i18n.ts.close" @click="$refs.modal.close()" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/components/MkModalWindow.vue b/packages/client/src/components/MkModalWindow.vue index fbe22654dc..b7ba30dd17 100644 --- a/packages/client/src/components/MkModalWindow.vue +++ b/packages/client/src/components/MkModalWindow.vue @@ -26,7 +26,7 @@ <button v-if="props.withOkButton" v-tooltip="i18n.ts.close" - :aria-label="i18n.t('close')" + :aria-label="i18n.ts.close" class="_button" @click="$emit('close')" > @@ -37,7 +37,7 @@ </span> <button v-if="!props.withOkButton" - :aria-label="i18n.t('close')" + :aria-label="i18n.ts.close" class="_button" @click="$emit('close')" > @@ -45,7 +45,7 @@ </button> <button v-if="props.withOkButton" - :aria-label="i18n.t('ok')" + :aria-label="i18n.ts.ok" class="_button" :disabled="props.okButtonDisabled" @click="$emit('ok')" diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index 828fafca05..65dbd17d80 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -636,9 +636,9 @@ function setPostExpanded(val: boolean) { const accessibleLabel = computed(() => { let label = `${appearNote.value.user.username}; `; if (appearNote.value.renote) { - label += `${i18n.t("renoted")} ${appearNote.value.renote.user.username}; `; + label += `${i18n.ts.renoted} ${appearNote.value.renote.user.username}; `; if (appearNote.value.renote.cw) { - label += `${i18n.t("cw")}: ${appearNote.value.renote.cw}; `; + label += `${i18n.ts.cw}: ${appearNote.value.renote.cw}; `; if (postIsExpanded.value) { label += `${appearNote.value.renote.text}; `; } @@ -647,7 +647,7 @@ const accessibleLabel = computed(() => { } } else { if (appearNote.value.cw) { - label += `${i18n.t("cw")}: ${appearNote.value.cw}; `; + label += `${i18n.ts.cw}: ${appearNote.value.cw}; `; if (postIsExpanded.value) { label += `${appearNote.value.text}; `; } diff --git a/packages/client/src/components/MkPollEditor.vue b/packages/client/src/components/MkPollEditor.vue index 4184398eb9..51bc99ec77 100644 --- a/packages/client/src/components/MkPollEditor.vue +++ b/packages/client/src/components/MkPollEditor.vue @@ -16,7 +16,7 @@ </MkInput> <button class="_button" - :aria-label="i18n.t('remove')" + :aria-label="i18n.ts.remove" @click="remove(i)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index c33da861ec..a2b1d9882c 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -11,7 +11,7 @@ > <header> <button v-if="!fixed" class="cancel _button" @click="cancel"> - <i :class="icon('ph-x')" :aria-label="i18n.t('close')"></i> + <i :class="icon('ph-x')" :aria-label="i18n.ts.close"></i> </button> <button v-if="$props.editId == null" @@ -108,7 +108,7 @@ {{ i18n.ts.quoteAttached }}<button class="_button" - :aria-label="i18n.t('removeQuote')" + :aria-label="i18n.ts.removeQuote" @click="quoteId = null" > <i :class="icon('ph-x')"></i> @@ -121,7 +121,7 @@ <MkAcct :user="u" /> <button class="_button" - :aria-label="i18n.t('removeRecipient')" + :aria-label="i18n.ts.removeRecipient" @click="removeVisibleUser(u)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/components/MkWidgets.vue b/packages/client/src/components/MkWidgets.vue index 0991cefc46..1b1dafa522 100644 --- a/packages/client/src/components/MkWidgets.vue +++ b/packages/client/src/components/MkWidgets.vue @@ -39,7 +39,7 @@ </button> <button class="remove _button" - :aria-label="i18n.t('close')" + :aria-label="i18n.ts.close" @click.prevent.stop="removeWidget(element)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/pages/follow-requests.vue b/packages/client/src/pages/follow-requests.vue index d5745346f0..d4999458c8 100644 --- a/packages/client/src/pages/follow-requests.vue +++ b/packages/client/src/pages/follow-requests.vue @@ -59,14 +59,14 @@ <div class="actions"> <button class="_button" - :aria-label="i18n.t('accept')" + :aria-label="i18n.ts.accept" @click="accept(req.follower)" > <i :class="icon('ph-check')"></i> </button> <button class="_button" - :aria-label="i18n.t('reject')" + :aria-label="i18n.ts.reject" @click="reject(req.follower)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/pages/gallery/edit.vue b/packages/client/src/pages/gallery/edit.vue index f696586138..7c3a4137a8 100644 --- a/packages/client/src/pages/gallery/edit.vue +++ b/packages/client/src/pages/gallery/edit.vue @@ -28,7 +28,7 @@ <button v-tooltip="i18n.ts.remove" class="remove _button" - :aria-label="i18n.t('remove')" + :aria-label="i18n.ts.remove" @click="remove(file)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index bc5698a084..abd53e96a8 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -19,14 +19,14 @@ <div class="buttons"> <button class="_button" - :aria-label="i18n.t('attachFile')" + :aria-label="i18n.ts.attachFile" @click="chooseFile" > <i :class="icon('ph-upload')"></i> </button> <button class="_button" - :aria-label="i18n.t('chooseEmoji')" + :aria-label="i18n.ts.chooseEmoji" @click="insertEmoji" > <i :class="icon('ph-smiley')"></i> diff --git a/packages/client/src/pages/my-groups/group.vue b/packages/client/src/pages/my-groups/group.vue index d606463938..ec3d4a7232 100644 --- a/packages/client/src/pages/my-groups/group.vue +++ b/packages/client/src/pages/my-groups/group.vue @@ -22,7 +22,7 @@ <div class="action"> <button class="_button" - :aria-label="i18n.t('removeMember')" + :aria-label="i18n.ts.removeMember" @click="removeUser(user)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/pages/my-lists/list.vue b/packages/client/src/pages/my-lists/list.vue index 8cc8457f61..adffca6cfb 100644 --- a/packages/client/src/pages/my-lists/list.vue +++ b/packages/client/src/pages/my-lists/list.vue @@ -49,7 +49,7 @@ <div class="action"> <button class="_button" - :aria-label="i18n.t('removeMember')" + :aria-label="i18n.ts.removeMember" @click="removeUser(user)" > <i :class="icon('ph-x')"></i> diff --git a/packages/client/src/pages/page-editor/page-editor.script-block.vue b/packages/client/src/pages/page-editor/page-editor.script-block.vue index d9403a4d52..b1db975527 100644 --- a/packages/client/src/pages/page-editor/page-editor.script-block.vue +++ b/packages/client/src/pages/page-editor/page-editor.script-block.vue @@ -104,7 +104,7 @@ <XV v-if="modelValue.value.expression" v-model="modelValue.value.expression" - :title="i18n.t(`_pages.script.blocks._fn.arg1`)" + :title="i18n.ts._pages.script.blocks._fn.arg1" :get-expected-type="() => null" :hpml="hpml" :fn-slots="modelValue.value.slots" diff --git a/packages/client/src/pages/page-editor/page-editor.vue b/packages/client/src/pages/page-editor/page-editor.vue index 64f5995f99..550878990f 100644 --- a/packages/client/src/pages/page-editor/page-editor.vue +++ b/packages/client/src/pages/page-editor/page-editor.vue @@ -431,7 +431,7 @@ function getScriptBlockList(type: string = null) { const userFns = variables.value.filter((x) => x.type === "fn"); if (userFns.length > 0) { list.unshift({ - label: i18n.t("_pages.script.categories.fn"), + label: i18n.ts._pages.script.categories.fn, items: userFns.map((v) => ({ value: "fn:" + v.name, text: v.name, diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 1dcb2e118f..72c9a204e8 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -239,7 +239,7 @@ function changeAvatar(ev) { const { canceled } = await os.yesno({ type: "question", - text: i18n.t("cropImageAsk"), + text: i18n.ts.cropImageAsk, }); if (!canceled) { @@ -264,7 +264,7 @@ function changeBanner(ev) { const { canceled } = await os.yesno({ type: "question", - text: i18n.t("cropImageAsk"), + text: i18n.ts.cropImageAsk, }); if (!canceled) { diff --git a/packages/client/src/ui/deck.vue b/packages/client/src/ui/deck.vue index acbdb1c127..cab107809d 100644 --- a/packages/client/src/ui/deck.vue +++ b/packages/client/src/ui/deck.vue @@ -123,7 +123,7 @@ <div v-if="isMobile" class="buttons"> <button - :aria-label="i18n.t('menu')" + :aria-label="i18n.ts.menu" class="button nav _button" @click="drawerMenuShowing = true" > @@ -138,14 +138,14 @@ ></span> </button> <button - :aria-label="i18n.t('home')" + :aria-label="i18n.ts.home" class="button home _button" @click="mainRouter.push('/')" > <i :class="icon('ph-house')"></i> </button> <button - :aria-label="i18n.t('notifications')" + :aria-label="i18n.ts.notifications" class="button notifications _button" @click="mainRouter.push('/my/notifications')" > @@ -160,7 +160,7 @@ ></span> </button> <button - :aria-label="i18n.t('note')" + :aria-label="i18n.ts.note" class="button post _button" @click="os.post()" > diff --git a/packages/client/src/ui/universal.vue b/packages/client/src/ui/universal.vue index 8d1a422f3a..c92c202474 100644 --- a/packages/client/src/ui/universal.vue +++ b/packages/client/src/ui/universal.vue @@ -35,7 +35,7 @@ <div v-if="isMobile" class="buttons"> <button v-vibrate="5" - :aria-label="i18n.t('menu')" + :aria-label="i18n.ts.menu" class="button nav _button" @click="drawerMenuShowing = true" > @@ -53,7 +53,7 @@ </button> <button v-vibrate="5" - :aria-label="i18n.t('home')" + :aria-label="i18n.ts.home" class="button home _button" @click=" mainRouter.currentRoute.value.name === 'index' @@ -71,7 +71,7 @@ </button> <button v-vibrate="5" - :aria-label="i18n.t('notifications')" + :aria-label="i18n.ts.notifications" class="button notifications _button" @click=" mainRouter.push('/my/notifications'); @@ -96,7 +96,7 @@ </button> <button v-if="replaceChatButtonWithAccountButton" - :aria-label="i18n.t('accounts')" + :aria-label="i18n.ts.accounts" class="button messaging _button" @click="openAccountMenu" > @@ -107,7 +107,7 @@ <button v-else v-vibrate="5" - :aria-label="i18n.t('messaging')" + :aria-label="i18n.ts.messaging" class="button messaging _button" @click=" mainRouter.push('/my/messaging'); @@ -142,7 +142,7 @@ <button v-else v-vibrate="5" - :aria-label="i18n.t('_deck._columns.widgets')" + :aria-label="i18n.ts._deck._columns.widgets" class="button widget _button" @click="widgetsShowing = true" > @@ -156,7 +156,7 @@ v-if="isMobile && mainRouter.currentRoute.value.name === 'index'" ref="postButton" v-vibrate="5" - :aria-label="i18n.t('note')" + :aria-label="i18n.ts.note" class="postButton button post _button" @click="os.post()" > @@ -168,7 +168,7 @@ " ref="postButton" class="postButton button post _button" - :aria-label="i18n.t('startMessaging')" + :aria-label="i18n.ts.startMessaging" @click="messagingStart" > <i :class="icon('ph-user-plus')"></i>