refactor(i18n): confirm module (#1210)

This commit is contained in:
webfansplz 2023-01-16 16:56:36 +08:00 committed by GitHub
parent 741eccf929
commit 2d96d1358b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 206 additions and 125 deletions

View file

@ -12,12 +12,12 @@ const isSelf = $(useSelfAccount(() => account))
const { t } = useI18n()
const { client } = $(useMasto())
const isConfirmed = async (title: string) => {
return await openConfirmDialog(t('common.confirm_dialog.title', [title])) === 'confirm'
}
const toggleMute = async (title: string) => {
if (!await isConfirmed(title))
const toggleMute = async () => {
if (!relationship!.muting && await openConfirmDialog({
title: t('confirm.mute_account.title', [account.acct]),
confirm: t('confirm.mute_account.confirm'),
cancel: t('confirm.mute_account.cancel'),
}) !== 'confirm')
return
relationship!.muting = !relationship!.muting
@ -28,24 +28,36 @@ const toggleMute = async (title: string) => {
: await client.v1.accounts.unmute(account.id)
}
const toggleBlockUser = async (title: string) => {
if (!await isConfirmed(title))
const toggleBlockUser = async () => {
if (!relationship!.blocking && await openConfirmDialog({
title: t('confirm.block_account.title', [account.acct]),
confirm: t('confirm.block_account.confirm'),
cancel: t('confirm.block_account.cancel'),
}) !== 'confirm')
return
relationship!.blocking = !relationship!.blocking
relationship = await client.v1.accounts[relationship!.blocking ? 'block' : 'unblock'](account.id)
}
const toggleBlockDomain = async (title: string) => {
if (!await isConfirmed(title))
const toggleBlockDomain = async () => {
if (!relationship!.domainBlocking && await openConfirmDialog({
title: t('confirm.block_domain.title', [getServerName(account)]),
confirm: t('confirm.block_domain.confirm'),
cancel: t('confirm.block_domain.cancel'),
}) !== 'confirm')
return
relationship!.domainBlocking = !relationship!.domainBlocking
await client.v1.domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
}
const toggleReblogs = async (title: string) => {
if (!await isConfirmed(title))
const toggleReblogs = async () => {
if (!relationship!.showingReblogs && await openConfirmDialog({
title: t('confirm.show_reblogs.title', [account.acct]),
confirm: t('confirm.show_reblogs.confirm'),
cancel: t('confirm.show_reblogs.cancel'),
}) !== 'confirm')
return
const showingReblogs = !relationship?.showingReblogs
@ -90,14 +102,14 @@ const toggleReblogs = async (title: string) => {
icon="i-ri:repeat-line"
:text="$t('menu.show_reblogs', [`@${account.acct}`])"
:command="command"
@click="toggleReblogs($t('menu.show_reblogs', [`@${account.acct}`]))"
@click="toggleReblogs()"
/>
<CommonDropdownItem
v-else
:text="$t('menu.hide_reblogs', [`@${account.acct}`])"
icon="i-ri:repeat-line"
:command="command"
@click="toggleReblogs($t('menu.hide_reblogs', [`@${account.acct}`]))"
@click="toggleReblogs()"
/>
<CommonDropdownItem
@ -105,14 +117,14 @@ const toggleReblogs = async (title: string) => {
:text="$t('menu.mute_account', [`@${account.acct}`])"
icon="i-ri:volume-up-fill"
:command="command"
@click="toggleMute($t('menu.mute_account', [`@${account.acct}`]))"
@click="toggleMute()"
/>
<CommonDropdownItem
v-else
:text="$t('menu.unmute_account', [`@${account.acct}`])"
icon="i-ri:volume-mute-line"
:command="command"
@click="toggleMute($t('menu.unmute_account', [`@${account.acct}`]))"
@click="toggleMute()"
/>
<CommonDropdownItem
@ -120,14 +132,14 @@ const toggleReblogs = async (title: string) => {
:text="$t('menu.block_account', [`@${account.acct}`])"
icon="i-ri:forbid-2-line"
:command="command"
@click="toggleBlockUser($t('menu.block_account', [`@${account.acct}`]))"
@click="toggleBlockUser()"
/>
<CommonDropdownItem
v-else
:text="$t('menu.unblock_account', [`@${account.acct}`])"
icon="i-ri:checkbox-circle-line"
:command="command"
@click="toggleBlockUser($t('menu.unblock_account', [`@${account.acct}`]))"
@click="toggleBlockUser()"
/>
<template v-if="getServerName(account) !== currentServer">
@ -136,14 +148,14 @@ const toggleReblogs = async (title: string) => {
:text="$t('menu.block_domain', [getServerName(account)])"
icon="i-ri:shut-down-line"
:command="command"
@click="toggleBlockDomain($t('menu.block_domain', [getServerName(account)]))"
@click="toggleBlockDomain()"
/>
<CommonDropdownItem
v-else
:text="$t('menu.unblock_domain', [getServerName(account)])"
icon="i-ri:restart-line"
:command="command"
@click="toggleBlockDomain($t('menu.unblock_domain', [getServerName(account)]))"
@click="toggleBlockDomain()"
/>
</template>
</template>

View file

@ -18,10 +18,10 @@ const emit = defineEmits<{
</div>
<div flex justify-end gap-2>
<button btn-text @click="emit('choice', 'cancel')">
{{ cancel || $t('common.confirm_dialog.cancel') }}
{{ cancel || $t('confirm.common.cancel') }}
</button>
<button btn-solid @click="emit('choice', 'confirm')">
{{ confirm || $t('common.confirm_dialog.confirm') }}
{{ confirm || $t('confirm.common.confirm') }}
</button>
</div>
</div>

View file

@ -63,9 +63,9 @@ const shareLink = async (status: mastodon.v1.Status) => {
const deleteStatus = async () => {
if (await openConfirmDialog({
title: t('menu.delete_confirm.title'),
confirm: t('menu.delete_confirm.confirm'),
cancel: t('menu.delete_confirm.cancel'),
title: t('confirm.delete_posts.title'),
confirm: t('confirm.delete_posts.confirm'),
cancel: t('confirm.delete_posts.cancel'),
}) !== 'confirm')
return

View file

@ -86,11 +86,6 @@
"toggle_zen_mode": "تبديل وضع الهدوء"
},
"common": {
"confirm_dialog": {
"cancel": "كلا",
"confirm": "نعم",
"title": "هل أنت متأكد؟"
},
"end_of_list": "نهاية القائمة",
"error": "حدث خطأ",
"in": "في",
@ -101,6 +96,17 @@
"draft_title": "مسودة {0}",
"drafts": "المسودات ({v})"
},
"confirm": {
"common": {
"cancel": "كلا",
"confirm": "نعم"
},
"delete_posts": {
"cancel": "إلغاء",
"confirm": "حذف",
"title": "هل أنت متأكد أنك تريد حذف هذا المنشور؟"
}
},
"conversation": {
"with": "مع"
},
@ -131,11 +137,6 @@
"copy_link_to_post": "انسخ الرابط إلى هذا المنشور",
"delete": "حذف",
"delete_and_redraft": "حذف وإعادة صياغة",
"delete_confirm": {
"cancel": "إلغاء",
"confirm": "حذف",
"title": "هل أنت متأكد أنك تريد حذف هذا المنشور؟"
},
"direct_message_account": "إرسال رسالة مباشرة إلى {0}",
"edit": "تعديل",
"hide_reblogs": "إخفاء المشاركات من {0}",

View file

@ -89,11 +89,6 @@
"toggle_zen_mode": "Zen-Modus ändern"
},
"common": {
"confirm_dialog": {
"cancel": "Abbrechen",
"confirm": "OK",
"title": "Bist du sicher, {0}?"
},
"end_of_list": "Ende der Liste",
"error": "FEHLER",
"in": "in",
@ -104,6 +99,18 @@
"draft_title": "Entwurf {0}",
"drafts": "Entwürfe ({v})"
},
"confirm": {
"common": {
"cancel": "Abbrechen",
"confirm": "OK",
"title": "Bist du sicher, {0}?"
},
"delete_posts": {
"cancel": "Abbrechen",
"confirm": "Löschen",
"title": "Möchtest du diesen Beitrag wirklich löschen?"
}
},
"conversation": {
"with": "mit"
},
@ -134,11 +141,6 @@
"copy_link_to_post": "Link zu diesem Beitrag kopieren",
"delete": "Löschen",
"delete_and_redraft": "Löschen und neu erstellen",
"delete_confirm": {
"cancel": "Abbrechen",
"confirm": "Löschen",
"title": "Möchtest du diesen Beitrag wirklich löschen?"
},
"direct_message_account": "Direktnachricht an {0}",
"edit": "Bearbeiten",
"hide_reblogs": "Boosts von {0} ausblenden",

View file

@ -89,11 +89,6 @@
"toggle_zen_mode": "Toggle zen mode"
},
"common": {
"confirm_dialog": {
"cancel": "No",
"confirm": "Yes",
"title": "Are you sure {0}?"
},
"end_of_list": "End of the list",
"error": "ERROR",
"in": "in",
@ -105,6 +100,35 @@
"drafts": "Drafts ({v})"
},
"confirm": {
"block_account": {
"cancel": "Cancel",
"confirm": "Block",
"title": "Are you sure you want to block {0}"
},
"block_domain": {
"cancel": "Cancel",
"confirm": "Block",
"title": "Are you sure you want to block {0}"
},
"common": {
"cancel": "No",
"confirm": "Yes"
},
"delete_posts": {
"cancel": "Cancel",
"confirm": "Delete",
"title": "Are you sure you want to delete this post?"
},
"mute_account": {
"cancel": "Cancel",
"confirm": "Mute",
"title": "Are you sure you want to mute {0}"
},
"show_reblogs": {
"cancel": "Cancel",
"confirm": "Show",
"title": "Are you sure you want to show boosts from {0}"
},
"unfollow": {
"cancel": "Cancel",
"confirm": "Unfollow",
@ -141,11 +165,6 @@
"copy_link_to_post": "Copy link to this post",
"delete": "Delete",
"delete_and_redraft": "Delete & re-draft",
"delete_confirm": {
"cancel": "Cancel",
"confirm": "Delete",
"title": "Are you sure you want to delete this post?"
},
"direct_message_account": "Direct message {0}",
"edit": "Edit",
"hide_reblogs": "Hide boosts from {0}",

View file

@ -86,11 +86,6 @@
"toggle_zen_mode": "Cambiar a modo zen"
},
"common": {
"confirm_dialog": {
"cancel": "No",
"confirm": "Si",
"title": "¿Estás seguro?"
},
"end_of_list": "Fin",
"error": "ERROR",
"in": "en",
@ -101,6 +96,18 @@
"draft_title": "Borrador {0}",
"drafts": "Borradores ({v})"
},
"confirm": {
"common": {
"cancel": "No",
"confirm": "Si",
"title": "¿Estás seguro?"
},
"delete_posts": {
"cancel": "Cancelar",
"confirm": "Eliminar",
"title": "¿Estás seguro que deseas eliminar esta publicación?"
}
},
"conversation": {
"with": "con"
},
@ -131,11 +138,6 @@
"copy_link_to_post": "Copiar enlace",
"delete": "Borrar",
"delete_and_redraft": "Borrar y volver a borrador",
"delete_confirm": {
"cancel": "Cancelar",
"confirm": "Eliminar",
"title": "¿Estás seguro que deseas eliminar esta publicación?"
},
"direct_message_account": "Mensaje directo a {0}",
"edit": "Editar",
"hide_reblogs": "Ocultar retoots de {0}",

View file

@ -83,11 +83,6 @@
"toggle_zen_mode": "Passer en mode zen"
},
"common": {
"confirm_dialog": {
"cancel": "Non",
"confirm": "Oui",
"title": "Êtes-vous sûr·e ?"
},
"end_of_list": "Fin de liste",
"error": "ERREUR",
"in": "sur",
@ -98,6 +93,18 @@
"draft_title": "Brouillon {0}",
"drafts": "Brouillons ({v})"
},
"confirm": {
"common": {
"cancel": "Non",
"confirm": "Oui",
"title": "Êtes-vous sûr·e ?"
},
"delete_posts": {
"cancel": "Annuler",
"confirm": "Supprimer",
"title": "Certain·e de vouloir supprimer ce message ?"
}
},
"conversation": {
"with": "avec"
},
@ -128,11 +135,6 @@
"copy_link_to_post": "Copier le lien du message",
"delete": "Supprimer",
"delete_and_redraft": "Supprimer et réécrire",
"delete_confirm": {
"cancel": "Annuler",
"confirm": "Supprimer",
"title": "Certain·e de vouloir supprimer ce message ?"
},
"direct_message_account": "Message direct à {0}",
"edit": "Éditer",
"hide_reblogs": "Cacher les boosts de {0}",

View file

@ -89,11 +89,6 @@
"toggle_zen_mode": "Alternar modo zen"
},
"common": {
"confirm_dialog": {
"cancel": "Não",
"confirm": "Sim",
"title": "Tem a certeza?"
},
"end_of_list": "Fim da lista",
"error": "ERRO",
"in": "em",
@ -104,6 +99,18 @@
"draft_title": "Rascunho {0}",
"drafts": "Rascunhos ({v})"
},
"confirm": {
"common": {
"cancel": "Não",
"confirm": "Sim",
"title": "Tem a certeza?"
},
"delete_posts": {
"cancel": "Cancelar",
"confirm": "Eliminar",
"title": "Tem a certeza que pretende eliminar esta publicação?"
}
},
"conversation": {
"with": "com"
},
@ -134,11 +141,6 @@
"copy_link_to_post": "Copiar ligação para esta publicação",
"delete": "Eliminar",
"delete_and_redraft": "Eliminar & re-editar",
"delete_confirm": {
"cancel": "Cancelar",
"confirm": "Eliminar",
"title": "Tem a certeza que pretende eliminar esta publicação?"
},
"direct_message_account": "Mensagem direta a {0}",
"edit": "Editar",
"hide_reblogs": "Esconder partilhas de {0}",

View file

@ -86,11 +86,6 @@
"toggle_zen_mode": "Zen mod durumunu değiştir"
},
"common": {
"confirm_dialog": {
"cancel": "Hayır",
"confirm": "Evet",
"title": "Emin misiniz?"
},
"end_of_list": "Listenin sonu",
"error": "HATA",
"in": "içinde",
@ -101,6 +96,18 @@
"draft_title": "Taslak {0}",
"drafts": "Taslaklar ({v})"
},
"confirm": {
"common": {
"cancel": "Hayır",
"confirm": "Evet",
"title": "Emin misiniz?"
},
"delete_posts": {
"cancel": "İptal et",
"confirm": "Sil",
"title": "Bu gönderiyi silmek istediğinizden emin misiniz?"
}
},
"conversation": {
"with": "ile"
},
@ -131,11 +138,6 @@
"copy_link_to_post": "Bu gönderinin linkini kopyala",
"delete": "Sil",
"delete_and_redraft": "Sil & yeniden taslak yap",
"delete_confirm": {
"cancel": "İptal et",
"confirm": "Sil",
"title": "Bu gönderiyi silmek istediğinizden emin misiniz?"
},
"direct_message_account": "{0} özel mesaj gönder",
"edit": "Düzenle",
"hide_reblogs": "{0} boostlarını gizle",

View file

@ -86,11 +86,6 @@
"toggle_zen_mode": "Перемкнути режим Zen"
},
"common": {
"confirm_dialog": {
"cancel": "Відмінити",
"confirm": "Так",
"title": "Ви впевнені?"
},
"end_of_list": "Кінець списку",
"error": "ПОМИЛКА",
"in": "в",
@ -101,6 +96,17 @@
"draft_title": "Чернетка {0}",
"drafts": "Чернетки ({v})"
},
"confirm": {
"common": {
"cancel": "Відмінити",
"confirm": "Так"
},
"delete_posts": {
"cancel": "Скасувати",
"confirm": "Видалити",
"title": "Ви впевнені, що хочете видалити цей допис?"
}
},
"conversation": {
"with": "з"
},
@ -131,11 +137,6 @@
"copy_link_to_post": "Скопіювати посилання на цей допис",
"delete": "Видалити",
"delete_and_redraft": "Видалити і переписати",
"delete_confirm": {
"cancel": "Скасувати",
"confirm": "Видалити",
"title": "Ви впевнені, що хочете видалити цей допис?"
},
"direct_message_account": "Пряме повідомлення {0}",
"edit": "Редагувати",
"mention_account": "Згадати {0}",

View file

@ -85,11 +85,6 @@
"toggle_zen_mode": "切换禅模式"
},
"common": {
"confirm_dialog": {
"cancel": "否",
"confirm": "是",
"title": "你确定 {0} 吗?"
},
"end_of_list": "列表到底啦",
"error": "错误",
"in": "在",
@ -101,6 +96,35 @@
"drafts": "草稿 ({v})"
},
"confirm": {
"block_account": {
"cancel": "取消",
"confirm": "拉黑",
"title": "你确定拉黑 {0} 吗?"
},
"block_domain": {
"cancel": "取消",
"confirm": "拉黑",
"title": "你确定拉黑域名 {0} 吗?"
},
"common": {
"cancel": "否",
"confirm": "是"
},
"delete_posts": {
"cancel": "取消",
"confirm": "删除",
"title": "你确定要删除这条帖文吗?"
},
"mute_account": {
"cancel": "取消",
"confirm": "屏蔽",
"title": "你确定屏蔽 {0} 吗?"
},
"show_reblogs": {
"cancel": "取消",
"confirm": "显示",
"title": "你确定要显示来自 {0} 的转发吗?"
},
"unfollow": {
"cancel": "取消",
"confirm": "取消关注",
@ -137,11 +161,6 @@
"copy_link_to_post": "复制这篇帖文的链接",
"delete": "删除",
"delete_and_redraft": "删除并重新编辑",
"delete_confirm": {
"cancel": "取消",
"confirm": "删除",
"title": "你确定要删除这条帖文吗?"
},
"direct_message_account": "私信 {0}",
"edit": "编辑",
"hide_reblogs": "隐藏来自 {0} 的转发",

View file

@ -88,11 +88,6 @@
"toggle_zen_mode": "切換禪模式"
},
"common": {
"confirm_dialog": {
"cancel": "否",
"confirm": "是",
"title": "你確定 {0} 嗎?"
},
"end_of_list": "清單到底啦",
"error": "錯誤",
"in": "在",
@ -104,6 +99,35 @@
"drafts": "草稿 ({v})"
},
"confirm": {
"block_account": {
"cancel": "取消",
"confirm": "拉黑",
"title": "你确定將 {0} 加入黑名單吗?"
},
"block_domain": {
"cancel": "取消",
"confirm": "拉黑",
"title": "你确定將 {0} 加入域名黑名單吗?"
},
"common": {
"cancel": "否",
"confirm": "是"
},
"delete_posts": {
"cancel": "取消",
"confirm": "刪除",
"title": "你確定要刪除這則貼文嗎?"
},
"mute_account": {
"cancel": "取消",
"confirm": "靜音",
"title": "你确定要靜音 {0}吗?"
},
"show_reblogs": {
"cancel": "取消",
"confirm": "顯示",
"title": "你确定要顯示來自 {0} 的轉發吗?"
},
"unfollow": {
"cancel": "取消",
"confirm": "取消關注",
@ -140,11 +164,6 @@
"copy_link_to_post": "複製這篇貼文的連結",
"delete": "刪除",
"delete_and_redraft": "刪除並重新編輯",
"delete_confirm": {
"cancel": "取消",
"confirm": "刪除",
"title": "你確定要刪除這則貼文嗎?"
},
"direct_message_account": "私訊 {0}",
"edit": "編輯",
"hide_reblogs": "隱藏來自 {0} 的轉發",