From 377c015c91f694585e9f77f79219946c4de37a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Wed, 4 Jan 2023 21:57:12 +0800 Subject: [PATCH] feat: add titles for settings --- composables/setups.ts | 11 +++++------ locales/zh-CN.json | 2 +- pages/settings.vue | 6 ++++++ pages/settings/about/index.vue | 6 ++++++ pages/settings/interface/index.vue | 8 ++++++++ pages/settings/language/index.vue | 8 ++++++++ pages/settings/preferences/index.vue | 8 ++++++++ pages/settings/profile/appearance.vue | 6 ++++++ pages/settings/profile/featured-tags.vue | 6 ++++++ pages/settings/profile/index.vue | 6 ++++++ pages/settings/users/index.vue | 6 ++++++ 11 files changed, 66 insertions(+), 7 deletions(-) diff --git a/composables/setups.ts b/composables/setups.ts index 595193791c..5a9947f23d 100644 --- a/composables/setups.ts +++ b/composables/setups.ts @@ -2,11 +2,10 @@ import { pwaInfo } from 'virtual:pwa-info' import type { Link } from '@unhead/schema' import type { Directions } from 'vue-i18n-routing' import { buildInfo } from 'virtual:build-info' -import { APP_NAME } from '~/constants' import type { LocaleObject } from '#i18n' export function setupPageHeader() { - const i18n = useI18n() + const { locale, locales, t } = useI18n() const link: Link[] = [] @@ -30,19 +29,19 @@ export function setupPageHeader() { } } - const localeMap = (i18n.locales.value as LocaleObject[]).reduce((acc, l) => { + const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => { acc[l.code!] = l.dir ?? 'auto' return acc }, {} as Record) useHeadFixed({ htmlAttrs: { - lang: () => i18n.locale.value, - dir: () => localeMap[i18n.locale.value] ?? 'auto', + lang: () => locale.value, + dir: () => localeMap[locale.value] ?? 'auto', }, titleTemplate: (title) => { let titleTemplate = title ? `${title} | ` : '' - titleTemplate += APP_NAME + titleTemplate += t('app_name') if (buildInfo.env !== 'release') titleTemplate += ` (${buildInfo.env})` return titleTemplate diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 79d1b2c8e7..0aabb6a308 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -248,7 +248,7 @@ }, "featured_tags": { "description": "人们可以在这些标签下浏览你的公共嘟文。", - "label": "精选的话题标签" + "label": "精选话题标签" }, "label": "个人资料" }, diff --git a/pages/settings.vue b/pages/settings.vue index e4aa13d71f..fe8d34f0c8 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -3,6 +3,12 @@ definePageMeta({ wideLayout: true, }) +const { t } = useI18n() + +useHeadFixed({ + title: () => t('nav.settings'), +}) + const route = useRoute() const isRootPath = computedEager(() => route.name === 'settings') diff --git a/pages/settings/about/index.vue b/pages/settings/about/index.vue index 718ee6d320..c903d06d8a 100644 --- a/pages/settings/about/index.vue +++ b/pages/settings/about/index.vue @@ -1,6 +1,12 @@ +