feat(i18n): add title texts (#201)

This commit is contained in:
Ayaka Rizumu 2022-11-28 22:25:32 +08:00 committed by GitHub
parent 72abfc3ce3
commit bc44b0127d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 37 additions and 13 deletions

View file

@ -10,6 +10,11 @@
"bookmarks": "Bookmarks", "bookmarks": "Bookmarks",
"profile": "Profile" "profile": "Profile"
}, },
"timeline": "Timeline",
"title": {
"local-timeline": "@:nav_side.local @:timeline",
"federated-timeline": "@:nav_side.federated @:timeline"
},
"account": { "account": {
"posts": "{0} Posts", "posts": "{0} Posts",
"following": "{0} Following", "following": "{0} Following",

View file

@ -10,6 +10,11 @@
"notifications": "通知", "notifications": "通知",
"profile": "个人资料" "profile": "个人资料"
}, },
"timeline": "时间轴",
"title": {
"local-timeline": "@:nav_side.local@:timeline",
"federated-timeline": "@:nav_side.federated@:timeline"
},
"account": { "account": {
"followers": "被 {0} 人关注", "followers": "被 {0} 人关注",
"following": "正在关注 {0} 人", "following": "正在关注 {0} 人",

View file

@ -2,6 +2,8 @@
const params = useRoute().params const params = useRoute().params
const accountName = $(computedEager(() => toShortHandle(params.account as string))) const accountName = $(computedEager(() => toShortHandle(params.account as string)))
const { t } = useI18n()
const { data: account, refresh } = $(await useAsyncData(() => fetchAccountByName(accountName).catch(() => null))) const { data: account, refresh } = $(await useAsyncData(() => fetchAccountByName(accountName).catch(() => null)))
if (account) { if (account) {
@ -20,7 +22,7 @@ onReactivated(() => {
<template> <template>
<MainContent back> <MainContent back>
<template #title> <template #title>
<span text-lg font-bold>{{ account ? getDisplayName(account) : 'Profile' }}</span> <span text-lg font-bold>{{ account ? getDisplayName(account) : t('nav_side.profile') }}</span>
</template> </template>
<template v-if="account"> <template v-if="account">

View file

@ -5,15 +5,17 @@ definePageMeta({
const paginator = useMasto().bookmarks.getIterator() const paginator = useMasto().bookmarks.getIterator()
const { t } = useI18n()
useHead({ useHead({
title: 'Bookmarks', title: () => t('nav_side.bookmarks'),
}) })
</script> </script>
<template> <template>
<MainContent> <MainContent>
<template #title> <template #title>
<span text-lg font-bold>Bookmarks</span> <span text-lg font-bold>{{ t('nav_side.bookmarks') }}</span>
</template> </template>
<slot> <slot>

View file

@ -5,15 +5,17 @@ definePageMeta({
const paginator = useMasto().conversations.getIterator() const paginator = useMasto().conversations.getIterator()
const { t } = useI18n()
useHead({ useHead({
title: 'Conversations', title: () => t('nav_side.conversations'),
}) })
</script> </script>
<template> <template>
<MainContent> <MainContent>
<template #title> <template #title>
<span text-lg font-bold>Conversations</span> <span text-lg font-bold>{{ t('nav_side.conversations') }}</span>
</template> </template>
<slot> <slot>

View file

@ -1,15 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
const paginator = useMasto().trends.getStatuses() const paginator = useMasto().trends.getStatuses()
const { t } = useI18n()
useHead({ useHead({
title: 'Explore', title: () => t('nav_side.explore'),
}) })
</script> </script>
<template> <template>
<MainContent> <MainContent>
<template #title> <template #title>
<div i-ri:hashtag h-6 mr-1 /><span>Explore</span> <div i-ri:hashtag h-6 mr-1 /><span>{{ t('nav_side.explore') }}</span>
</template> </template>
<slot> <slot>

View file

@ -5,6 +5,8 @@ definePageMeta({
middleware: 'auth', middleware: 'auth',
}) })
const { t } = useI18n()
const tabNames = ['All', 'Mentions'] as const const tabNames = ['All', 'Mentions'] as const
const tab = $(useLocalStorage<typeof tabNames[number]>(STORAGE_KEY_NOTIFY_TAB, 'All')) const tab = $(useLocalStorage<typeof tabNames[number]>(STORAGE_KEY_NOTIFY_TAB, 'All'))
@ -13,14 +15,14 @@ const paginator = $computed(() => {
}) })
useHead({ useHead({
title: 'Notifications', title: () => t('nav_side.notifications'),
}) })
</script> </script>
<template> <template>
<MainContent> <MainContent>
<template #title> <template #title>
<span text-lg font-bold>Notifications</span> <span text-lg font-bold>{{ t('nav_side.notifications') }}</span>
</template> </template>
<template #header> <template #header>

View file

@ -3,15 +3,17 @@ const paginator = useMasto().timelines.getPublicIterable()
const stream = await useMasto().stream.streamPublicTimeline() const stream = await useMasto().stream.streamPublicTimeline()
onBeforeUnmount(() => stream.disconnect()) onBeforeUnmount(() => stream.disconnect())
const { t } = useI18n()
useHead({ useHead({
title: 'Federated', title: () => t('nav_side.federated'),
}) })
</script> </script>
<template> <template>
<MainContent> <MainContent>
<template #title> <template #title>
<span text-lg font-bold>Federated Timeline</span> <span text-lg font-bold>{{ t('title.federated-timeline') }}</span>
</template> </template>
<slot> <slot>

View file

@ -3,15 +3,17 @@ const paginator = useMasto().timelines.getPublicIterable({ local: true })
const stream = await useMasto().stream.streamCommunityTimeline() const stream = await useMasto().stream.streamCommunityTimeline()
onBeforeUnmount(() => stream.disconnect()) onBeforeUnmount(() => stream.disconnect())
const { t } = useI18n()
useHead({ useHead({
title: 'Local', title: () => t('nav_side.local'),
}) })
</script> </script>
<template> <template>
<MainContent> <MainContent>
<template #title> <template #title>
<span text-lg font-bold>Local timeline</span> <span text-lg font-bold>{{ t('title.local-timeline') }}</span>
</template> </template>
<slot> <slot>