feat(i18n): improve translations of command palette and others (#341)

Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
zio/stable
Alex 2022-12-05 13:48:23 +08:00 committed by GitHub
parent 4214202b79
commit e8bdceac68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 21 deletions

View File

@ -35,7 +35,7 @@ const switchUser = (user: UserLogin) => {
</template> </template>
<div border="t base" pt2> <div border="t base" pt2>
<CommonDropdownItem <CommonDropdownItem
:text=" $t('user.add_existing')" :text="$t('user.add_existing')"
icon="i-ri:user-add-line" icon="i-ri:user-add-line"
@click="openSigninDialog" @click="openSigninDialog"
/> />

View File

@ -201,7 +201,7 @@ export const useCommands = (cmds: () => CommandProvider[]) => {
} }
export const provideGlobalCommands = () => { export const provideGlobalCommands = () => {
const { locale } = useI18n() const { locale, t } = useI18n()
const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> } const { locales } = useI18n() as { locales: ComputedRef<LocaleObject[]> }
const users = useUsers() const users = useUsers()
@ -210,9 +210,9 @@ export const provideGlobalCommands = () => {
visible: () => currentUser.value, visible: () => currentUser.value,
name: 'Compose', name: () => t('action.compose'),
icon: 'i-ri:quill-pen-line', icon: 'i-ri:quill-pen-line',
description: 'Write a new post', description: () => t('command.compose_desc'),
onActivate() { onActivate() {
openPublishDialog() openPublishDialog()
@ -222,7 +222,7 @@ export const provideGlobalCommands = () => {
useCommand({ useCommand({
scope: 'Preferences', scope: 'Preferences',
name: 'Toggle dark mode', name: () => t('command.toggle_dark_mode'),
icon: () => isDark.value ? 'i-ri:sun-line' : 'i-ri:moon-line', icon: () => isDark.value ? 'i-ri:sun-line' : 'i-ri:moon-line',
onActivate() { onActivate() {
@ -233,7 +233,7 @@ export const provideGlobalCommands = () => {
useCommand({ useCommand({
scope: 'Preferences', scope: 'Preferences',
name: 'Toggle Zen mode', name: () => t('command.toggle_zen_mode'),
icon: () => isZenMode.value ? 'i-ri:layout-right-2-line' : 'i-ri:layout-right-line', icon: () => isZenMode.value ? 'i-ri:layout-right-2-line' : 'i-ri:layout-right-line',
onActivate() { onActivate() {
@ -244,7 +244,7 @@ export const provideGlobalCommands = () => {
useCommand({ useCommand({
scope: 'Preferences', scope: 'Preferences',
name: 'Select language', name: () => t('command.select_lang'),
icon: 'i-ri:earth-line', icon: 'i-ri:earth-line',
onComplete: () => ({ onComplete: () => ({
@ -267,8 +267,8 @@ export const provideGlobalCommands = () => {
useCommand({ useCommand({
scope: 'Account', scope: 'Account',
name: 'Sign in', name: () => t('action.sign_in'),
description: 'Add an existing account', description: () => t('command.sign_in_desc'),
icon: 'i-ri:user-add-line', icon: 'i-ri:user-add-line',
onActivate() { onActivate() {
@ -280,8 +280,8 @@ export const provideGlobalCommands = () => {
visible: () => users.value.length > 1, visible: () => users.value.length > 1,
name: 'Switch account', name: () => t('action.switch_account'),
description: 'Switch to another account', description: t('command.switch_account_desc'),
icon: 'i-ri:user-shared-line', icon: 'i-ri:user-shared-line',
onComplete: () => ({ onComplete: () => ({
@ -295,7 +295,7 @@ export const provideGlobalCommands = () => {
visible: () => user.account.id !== currentUser.value?.account.id, visible: () => user.account.id !== currentUser.value?.account.id,
name: `Switch to ${getFullHandle(user.account)}`, name: () => t('command.switch_account', [getFullHandle(user.account)]),
icon: 'i-ri:user-shared-line', icon: 'i-ri:user-shared-line',
onActivate() { onActivate() {
@ -307,7 +307,7 @@ export const provideGlobalCommands = () => {
visible: () => currentUser.value, visible: () => currentUser.value,
name: () => `Sign out ${getFullHandle(currentUser.value!.account)}`, name: () => t('user.sign_out_account', [getFullHandle(currentUser.value!.account)]),
icon: 'i-ri:logout-box-line', icon: 'i-ri:logout-box-line',
onActivate() { onActivate() {

View File

@ -35,7 +35,7 @@
<AccountInfo :account="currentUser.account" md:break-words /> <AccountInfo :account="currentUser.account" md:break-words />
</NuxtLink> </NuxtLink>
<VDropdown :distance="0" placement="bottom-end"> <VDropdown :distance="0" placement="bottom-end">
<button btn-action-icon aria-label="Switch account"> <button btn-action-icon :aria-label="$t('action.switch_account')">
<div i-ri:more-2-line /> <div i-ri:more-2-line />
</button> </button>
<template #popper> <template #popper>

View File

@ -39,13 +39,22 @@
"reply": "Reply", "reply": "Reply",
"save_changes": "Save changes", "save_changes": "Save changes",
"sign_in": "Sign in", "sign_in": "Sign in",
"switch_account": "Switch account",
"vote": "Vote" "vote": "Vote"
}, },
"app_desc_short": "A Mastodon client made with 🧡", "app_desc_short": "A Mastodon client made with 🧡",
"app_name": "Elk", "app_name": "Elk",
"command": { "command": {
"activate": "Activate", "activate": "Activate",
"complete": "Complete" "complete": "Complete",
"compose_desc": "Write a new post",
"lang": "Languages",
"select_lang": "Select language",
"sign_in_desc": "Add an existing account",
"switch_account": "Switch to {0}",
"switch_account_desc": "Switch to another account",
"toggle_dark_mode": "Toggle dark mode",
"toggle_zen_mode": "Toggle zen mode"
}, },
"common": { "common": {
"end_of_list": "End of the list", "end_of_list": "End of the list",

View File

@ -39,13 +39,22 @@
"reply": "回复", "reply": "回复",
"save_changes": "保存更改", "save_changes": "保存更改",
"sign_in": "登鹿", "sign_in": "登鹿",
"switch_account": "切换帐号",
"vote": "投票" "vote": "投票"
}, },
"app_desc_short": "用 🧡 制作的 Mastodon 客户端", "app_desc_short": "用 🧡 制作的 Mastodon 客户端",
"app_name": "鹿鸣", "app_name": "鹿鸣",
"command": { "command": {
"activate": "执行", "activate": "执行",
"complete": "完成" "complete": "完成",
"compose_desc": "写一条新帖文",
"lang": "语言",
"select_lang": "选择语言",
"sign_in_desc": "添加现有帐户",
"switch_account": "切换到{0}",
"switch_account_desc": "切换到另一个帐户",
"toggle_dark_mode": "切换深色模式",
"toggle_zen_mode": "切换禅模式"
}, },
"common": { "common": {
"end_of_list": "列表到底啦", "end_of_list": "列表到底啦",
@ -75,7 +84,7 @@
"menu": { "menu": {
"block_account": "拉黑 {0}", "block_account": "拉黑 {0}",
"block_domain": "拉黑域名 {0}", "block_domain": "拉黑域名 {0}",
"copy_link_to_post": "复制这篇的链接", "copy_link_to_post": "复制这篇文的链接",
"delete": "删除", "delete": "删除",
"delete_and_redraft": "删除并重新编辑", "delete_and_redraft": "删除并重新编辑",
"direct_message_account": "私信 {0}", "direct_message_account": "私信 {0}",
@ -83,17 +92,17 @@
"mention_account": "提及 {0}", "mention_account": "提及 {0}",
"mute_account": "屏蔽 {0}", "mute_account": "屏蔽 {0}",
"open_in_original_site": "从源站打开", "open_in_original_site": "从源站打开",
"pin_on_profile": "钉选在个人资料上", "pin_on_profile": "置顶在个人资料上",
"show_untranslated": "显示原文", "show_untranslated": "显示原文",
"toggle_theme": { "toggle_theme": {
"dark": "切换深色模式", "dark": "切换深色模式",
"light": "切换亮色模式" "light": "切换亮色模式"
}, },
"translate_post": "翻译帖", "translate_post": "翻译帖",
"unblock_account": "解除拉黑 {0}", "unblock_account": "解除拉黑 {0}",
"unblock_domain": "解除拉黑域名 {0}", "unblock_domain": "解除拉黑域名 {0}",
"unmute_account": "解除屏蔽 {0}", "unmute_account": "解除屏蔽 {0}",
"unpin_on_profile": "取消钉选" "unpin_on_profile": "取消置顶"
}, },
"nav_footer": { "nav_footer": {
"built_at": "于 {0} 构建", "built_at": "于 {0} 构建",
@ -131,7 +140,7 @@
"default_1": "在想些什么?", "default_1": "在想些什么?",
"reply_to_account": "回复 {0}", "reply_to_account": "回复 {0}",
"replying": "回复", "replying": "回复",
"the_thread": "这个帖" "the_thread": "这个帖"
}, },
"state": { "state": {
"edited": "(已编辑)", "edited": "(已编辑)",
@ -141,6 +150,9 @@
}, },
"status": { "status": {
"edited": "在 {0} 编辑了", "edited": "在 {0} 编辑了",
"filter_hidden_phrase": "筛选依据",
"filter_removed_phrase": "从筛选中移除",
"filter_show_anyway": "仍然展示",
"poll": { "poll": {
"count": "{0} 次投票", "count": "{0} 次投票",
"ends": "将在 {0} 结束", "ends": "将在 {0} 结束",