perf: optimize the naming of locale key

This commit is contained in:
vince
2024-07-10 21:55:16 +08:00
parent 25a1e93ab2
commit 4674380266
59 changed files with 664 additions and 1253 deletions

View File

@@ -49,10 +49,10 @@ const appName = computed(() => preferences.app.name);
<div class="flex-col-center -enter-x mr-20 h-full">
<SloganIcon :alt="appName" class="animate-float h-64 w-2/5" />
<div class="text-1xl mt-6 font-sans text-white lg:text-2xl">
{{ $t('authentication.page-title') }}
{{ $t('authentication.pageTitle') }}
</div>
<div class="dark:text-muted-foreground mt-2 text-white/60">
{{ $t('authentication.page-desc') }}
{{ $t('authentication.pageDesc') }}
</div>
</div>
</div>

View File

@@ -117,7 +117,7 @@ function useTabs() {
},
icon: IcRoundRefresh,
key: 'reload',
text: $t('preferences.tabbar.context-menu.reload'),
text: $t('preferences.tabbar.contextMenu.reload'),
},
{
disabled: !!affixTab || disabled,
@@ -126,7 +126,7 @@ function useTabs() {
},
icon: IcRoundClose,
key: 'close',
text: $t('preferences.tabbar.context-menu.close'),
text: $t('preferences.tabbar.contextMenu.close'),
},
{
handler: async () => {
@@ -138,8 +138,8 @@ function useTabs() {
key: 'affix',
separator: true,
text: affixTab
? $t('preferences.tabbar.context-menu.unpin')
: $t('preferences.tabbar.context-menu.pin'),
? $t('preferences.tabbar.contextMenu.unpin')
: $t('preferences.tabbar.contextMenu.pin'),
},
{
disabled: closeLeftDisabled,
@@ -148,7 +148,7 @@ function useTabs() {
},
icon: MdiFormatHorizontalAlignLeft,
key: 'close-left',
text: $t('preferences.tabbar.context-menu.close-left'),
text: $t('preferences.tabbar.contextMenu.closeLeft'),
},
{
disabled: closeRightDisabled,
@@ -158,7 +158,7 @@ function useTabs() {
icon: MdiFormatHorizontalAlignRight,
key: 'close-right',
separator: true,
text: $t('preferences.tabbar.context-menu.close-right'),
text: $t('preferences.tabbar.contextMenu.closeRight'),
},
{
disabled: closeOtherDisabled,
@@ -167,7 +167,7 @@ function useTabs() {
},
icon: MdiArrowExpandHorizontal,
key: 'close-other',
text: $t('preferences.tabbar.context-menu.close-other'),
text: $t('preferences.tabbar.contextMenu.closeOther'),
},
{
disabled,
@@ -176,7 +176,7 @@ function useTabs() {
},
icon: IcRoundMultipleStop,
key: 'close-all',
text: $t('preferences.tabbar.context-menu.close-all'),
text: $t('preferences.tabbar.contextMenu.closeAll'),
},
// {
// icon: 'icon-[material-symbols--back-to-tab-sharp]',

View File

@@ -116,7 +116,7 @@ onMounted(() => {
<IcRoundSearch class="mt-1 size-4" />
<input
v-model="keyword"
:placeholder="$t('widgets.search.search-navigate')"
:placeholder="$t('widgets.search.searchNavigate')"
class="ring-none placeholder:text-muted-foreground w-[80%] rounded-md border border-none bg-transparent p-2 text-sm outline-none ring-0 ring-offset-transparent focus-visible:ring-transparent"
/>
</DialogTitle>

View File

@@ -223,7 +223,7 @@ onMounted(() => {
>
<IcRoundSearchOff class="size-12" />
<p class="my-10 text-xs">
{{ $t('widgets.search.no-results') }}
{{ $t('widgets.search.noResults') }}
<span class="text-foreground text-sm font-medium">
"{{ keyword }}"
</span>
@@ -235,7 +235,7 @@ onMounted(() => {
class="text-muted-foreground text-center"
>
<p class="my-10 text-xs">
{{ $t('widgets.search.no-recent') }}
{{ $t('widgets.search.noRecent') }}
</p>
</div>

View File

@@ -21,7 +21,7 @@ const menus = computed((): VbenDropdownMenuItem[] => [
{
icon: MdiDockLeft,
key: 'panel-left',
text: $t('authentication.layout.align-left'),
text: $t('authentication.layout.alignLeft'),
},
{
icon: MdiDockBottom,
@@ -31,7 +31,7 @@ const menus = computed((): VbenDropdownMenuItem[] => [
{
icon: MdiDockRight,
key: 'panel-right',
text: $t('authentication.layout.align-right'),
text: $t('authentication.layout.alignRight'),
},
]);

View File

@@ -84,7 +84,7 @@ function handleClick(item: NotificationItem) {
<div class="flex items-center justify-between p-4 py-3">
<div class="text-foreground">{{ $t('widgets.notifications') }}</div>
<VbenIconButton
:tooltip="$t('widgets.make-all-as-read')"
:tooltip="$t('widgets.markAllAsRead')"
@click="handleMakeAll"
>
<IcRoundMarkEmailRead />
@@ -127,7 +127,7 @@ function handleClick(item: NotificationItem) {
<template v-else>
<div class="flex-center text-muted-foreground min-h-[150px] w-full">
{{ $t('common.not-data') }}
{{ $t('common.noData') }}
</div>
</template>
@@ -135,10 +135,10 @@ function handleClick(item: NotificationItem) {
class="border-border flex items-center justify-between border-t px-4 py-3"
>
<VbenButton size="sm" variant="ghost" @click="handleClear">
{{ $t('widgets.clear-notifications') }}
{{ $t('widgets.clearNotifications') }}
</VbenButton>
<VbenButton size="sm" @click="handleViewAll">
{{ $t('widgets.view-all') }}
{{ $t('widgets.viewAll') }}
</VbenButton>
</div>
</div>

View File

@@ -25,6 +25,6 @@ const localeItems: SelectListItem[] = SUPPORT_LANGUAGES.map((item) => ({
{{ $t('preferences.language') }}
</SelectItem>
<SwitchItem v-model="appDynamicTitle">
{{ $t('preferences.dynamic-title') }}
{{ $t('preferences.dynamicTitle') }}
</SwitchItem>
</template>

View File

@@ -35,7 +35,7 @@ const disableItem = computed(() => {
{{ $t('preferences.breadcrumb.enable') }}
</SwitchItem>
<SwitchItem v-model="breadcrumbHideOnlyOne" :disabled="disableItem">
{{ $t('preferences.breadcrumb.hide-only-one') }}
{{ $t('preferences.breadcrumb.hideOnlyOne') }}
</SwitchItem>
<SwitchItem v-model="breadcrumbShowIcon" :disabled="disableItem">
{{ $t('preferences.breadcrumb.icon') }}

View File

@@ -30,10 +30,10 @@ const itemDisabled = computed(() => props.disabled || !copyrightEnable.value);
</SwitchItem>
<InputItem v-model="copyrightCompanyName" :disabled="itemDisabled">
{{ $t('preferences.copyright.company-name') }}
{{ $t('preferences.copyright.companyName') }}
</InputItem>
<InputItem v-model="copyrightCompanySiteLink" :disabled="itemDisabled">
{{ $t('preferences.copyright.company-site-link') }}
{{ $t('preferences.copyright.companySiteLink') }}
</InputItem>
<InputItem v-model="copyrightDate" :disabled="itemDisabled">
{{ $t('preferences.copyright.date') }}
@@ -43,6 +43,6 @@ const itemDisabled = computed(() => props.disabled || !copyrightEnable.value);
{{ $t('preferences.copyright.icp') }}
</InputItem>
<InputItem v-model="copyrightIcpLink" :disabled="itemDisabled">
{{ $t('preferences.copyright.icp-link') }}
{{ $t('preferences.copyright.icpLink') }}
</InputItem>
</template>

View File

@@ -17,19 +17,19 @@ const headerMode = defineModel<LayoutHeaderModeType>('headerMode');
const localeItems: SelectListItem[] = [
{
label: $t('preferences.header.mode-static'),
label: $t('preferences.header.modeStatic'),
value: 'static',
},
{
label: $t('preferences.header.mode-fixed'),
label: $t('preferences.header.modeFixed'),
value: 'fixed',
},
{
label: $t('preferences.header.mode-auto'),
label: $t('preferences.header.modeAuto'),
value: 'auto',
},
{
label: $t('preferences.header.mode-auto-scroll'),
label: $t('preferences.header.modeAutoScroll'),
value: 'auto-scroll',
},
];

View File

@@ -38,27 +38,27 @@ const components: Record<LayoutType, Component> = {
const PRESET = computed((): PresetItem[] => [
{
name: $t('preferences.vertical'),
tip: $t('preferences.vertical-tip'),
tip: $t('preferences.verticalTip'),
type: 'sidebar-nav',
},
{
name: $t('preferences.two-column'),
tip: $t('preferences.two-column-tip'),
name: $t('preferences.twoColumn'),
tip: $t('preferences.twoColumnTip'),
type: 'sidebar-mixed-nav',
},
{
name: $t('preferences.horizontal'),
tip: $t('preferences.vertical-tip'),
tip: $t('preferences.horizontalTip'),
type: 'header-nav',
},
{
name: $t('preferences.mixed-menu'),
tip: $t('preferences.mixed-menu-tip'),
name: $t('preferences.mixedMenu'),
tip: $t('preferences.mixedMenuTip'),
type: 'mixed-nav',
},
{
name: $t('preferences.full-content'),
tip: $t('preferences.full-content-tip'),
name: $t('preferences.fullContent'),
tip: $t('preferences.fullContentTip'),
type: 'full-content',
},
]);

View File

@@ -28,18 +28,18 @@ const stylesItems: SelectListItem[] = [
:disabled="disabled"
:items="stylesItems"
>
{{ $t('preferences.navigation-menu.style') }}
{{ $t('preferences.navigationMenu.style') }}
</ToggleItem>
<SwitchItem
v-model="navigationSplit"
:disabled="disabledNavigationSplit || disabled"
>
{{ $t('preferences.navigation-menu.split') }}
{{ $t('preferences.navigationMenu.split') }}
<template #tip>
{{ $t('preferences.navigation-menu.split-tip') }}
{{ $t('preferences.navigationMenu.splitTip') }}
</template>
</SwitchItem>
<SwitchItem v-model="navigationAccordion" :disabled="disabled">
{{ $t('preferences.navigation-menu.accordion') }}
{{ $t('preferences.navigationMenu.accordion') }}
</SwitchItem>
</template>

View File

@@ -29,7 +29,7 @@ const sidebarCollapsed = defineModel<boolean>('sidebarCollapsed');
v-model="sidebarCollapsedShowTitle"
:disabled="!sidebarEnable || disabled"
>
{{ $t('preferences.sidebar.collapsed-show-title') }}
{{ $t('preferences.sidebar.collapsedShowTitle') }}
</SwitchItem>
<NumberFieldItem
v-model="sidebarWidth"

View File

@@ -18,13 +18,13 @@ const widgetSidebarToggle = defineModel<boolean>('widgetSidebarToggle');
<template>
<SwitchItem v-model="widgetGlobalSearch">
{{ $t('preferences.widget.global-search') }}
{{ $t('preferences.widget.globalSearch') }}
</SwitchItem>
<SwitchItem v-model="widgetThemeToggle">
{{ $t('preferences.widget.theme-toggle') }}
{{ $t('preferences.widget.themeToggle') }}
</SwitchItem>
<SwitchItem v-model="widgetLanguageToggle">
{{ $t('preferences.widget.language-toggle') }}
{{ $t('preferences.widget.languageToggle') }}
</SwitchItem>
<SwitchItem v-model="widgetFullscreen">
{{ $t('preferences.widget.fullscreen') }}
@@ -33,9 +33,9 @@ const widgetSidebarToggle = defineModel<boolean>('widgetSidebarToggle');
{{ $t('preferences.widget.notification') }}
</SwitchItem>
<SwitchItem v-model="widgetAiAssistant">
{{ $t('preferences.widget.ai-assistant') }}
{{ $t('preferences.widget.aiAssistant') }}
</SwitchItem>
<SwitchItem v-model="widgetSidebarToggle">
{{ $t('preferences.widget.sidebar-toggle') }}
{{ $t('preferences.widget.sidebarToggle') }}
</SwitchItem>
</template>

View File

@@ -22,21 +22,21 @@ const altView = computed(() => (isWindowsOs() ? 'Alt' : '⌥'));
<template>
<SwitchItem v-model="shortcutKeysEnable">
{{ $t('preferences.shortcut-keys.title') }}
{{ $t('preferences.shortcutKeys.title') }}
</SwitchItem>
<SwitchItem v-if="shortcutKeysEnable" v-model="shortcutKeysGlobalSearch">
{{ $t('preferences.shortcut-keys.search') }}
{{ $t('preferences.shortcutKeys.search') }}
<template #shortcut>
{{ isWindowsOs() ? 'Ctrl' : '⌘' }}
<kbd> K </kbd>
</template>
</SwitchItem>
<SwitchItem v-if="shortcutKeysEnable" v-model="shortcutKeysLogout">
{{ $t('preferences.shortcut-keys.logout') }}
{{ $t('preferences.shortcutKeys.logout') }}
<template #shortcut> {{ altView }} Q </template>
</SwitchItem>
<SwitchItem v-if="shortcutKeysEnable" v-model="shortcutKeysPreferences">
{{ $t('preferences.shortcut-keys.preferences') }}
{{ $t('preferences.shortcutKeys.preferences') }}
<template #shortcut> {{ altView }} , </template>
</SwitchItem>
</template>

View File

@@ -40,17 +40,17 @@ function typeView(name: BuiltinThemeType) {
return $t('preferences.theme.builtin.rose');
}
case 'sky-blue': {
return $t('preferences.theme.builtin.sky-blue');
return $t('preferences.theme.builtin.skyBlue');
}
case 'deep-blue': {
return $t('preferences.theme.builtin.deep-blue');
return $t('preferences.theme.builtin.deepBlue');
}
case 'green': {
return $t('preferences.theme.builtin.green');
}
case 'deep-green': {
return $t('preferences.theme.builtin.deep-green');
return $t('preferences.theme.builtin.deepGreen');
}
case 'orange': {
return $t('preferences.theme.builtin.orange');

View File

@@ -18,9 +18,9 @@ const appColorGrayMode = defineModel<boolean>('appColorGrayMode', {
<template>
<SwitchItem v-model="appColorWeakMode">
{{ $t('preferences.theme.weak-mode') }}
{{ $t('preferences.theme.weakMode') }}
</SwitchItem>
<SwitchItem v-model="appColorGrayMode">
{{ $t('preferences.theme.gray-mode') }}
{{ $t('preferences.theme.grayMode') }}
</SwitchItem>
</template>

View File

@@ -49,7 +49,7 @@ function nameView(name: string) {
return $t('preferences.theme.dark');
}
case 'auto': {
return $t('preferences.follow-system');
return $t('preferences.followSystem');
}
}
}
@@ -79,7 +79,7 @@ function nameView(name: string) {
:disabled="modelValue !== 'light'"
class="mt-6"
>
{{ $t('preferences.theme.dark-menu') }}
{{ $t('preferences.theme.darkMenu') }}
</SwitchItem>
</div>
</template>

View File

@@ -162,7 +162,7 @@ const tabs = computed((): SegmentedItem[] => {
value: 'layout',
},
{
label: $t('preferences.shortcut-keys.title'),
label: $t('preferences.shortcutKeys.title'),
value: 'shortcutKey',
},
{
@@ -187,8 +187,8 @@ async function handleCopy() {
await copy(JSON.stringify(diffPreference.value, null, 2));
toast({
description: $t('preferences.copy'),
title: $t('preferences.copy-success'),
description: $t('preferences.copyPreferences'),
title: $t('preferences.copyPreferencesSuccess'),
});
}
@@ -205,12 +205,8 @@ async function handleReset() {
resetPreferences();
await loadLocaleMessages(preferences.app.locale);
toast({
description: $t('preferences.reset-title'),
title: $t('preferences.reset-success'),
});
toast({
description: $t('preferences.reset-title'),
title: $t('preferences.reset-success'),
description: $t('preferences.resetTitle'),
title: $t('preferences.resetSuccess'),
});
}
</script>
@@ -236,7 +232,7 @@ async function handleReset() {
<div class="flex items-center">
<VbenIconButton
:disabled="!diffPreference"
:tooltip="$t('preferences.reset-tip')"
:tooltip="$t('preferences.resetTip')"
class="relative"
>
<span
@@ -323,7 +319,7 @@ async function handleReset() {
/>
</Block>
<Block :title="$t('preferences.navigation-menu.title')">
<Block :title="$t('preferences.navigationMenu.title')">
<Navigation
v-model:navigation-accordion="navigationAccordion"
v-model:navigation-split="navigationSplit"
@@ -384,7 +380,7 @@ async function handleReset() {
</template>
<template #shortcutKey>
<Block :title="$t('preferences.shortcut-keys.global')">
<Block :title="$t('preferences.shortcutKeys.global')">
<GlobalShortcutKeys
v-model:shortcut-keys-enable="shortcutKeysEnable"
v-model:shortcut-keys-global-search="shortcutKeysGlobalSearch"
@@ -407,7 +403,7 @@ async function handleReset() {
@click="handleClearCache"
>
<IcRoundRestartAlt class="mr-2 size-4" />
{{ $t('preferences.clear-and-logout') }}
{{ $t('preferences.clearAndLogout') }}
</VbenButton>
<VbenButton
:disabled="!diffPreference"
@@ -417,7 +413,7 @@ async function handleReset() {
@click="handleCopy"
>
<IcRoundFolderCopy class="mr-2 size-3" />
{{ $t('preferences.copy') }}
{{ $t('preferences.copyPreferences') }}
</VbenButton>
</template>
</VbenSheet>

View File

@@ -49,7 +49,7 @@ const PRESETS = [
{
icon: IcRoundMotionPhotosAuto,
name: 'auto',
title: $t('preferences.follow-system'),
title: $t('preferences.followSystem'),
},
];
</script>

View File

@@ -121,7 +121,7 @@ if (enableShortcutKey.value) {
<VbenAlertDialog
v-model:open="openDialog"
:cancel-text="$t('common.cancel')"
:content="$t('widgets.logout-tip')"
:content="$t('widgets.logoutTip')"
:submit-text="$t('common.confirm')"
:title="$t('common.prompt')"
@submit="handleSubmitLogout"