From 1426238245c646a3acbefb9a2ae60101fc98fa32 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 15 Jul 2025 16:40:35 +0800 Subject: [PATCH] feat(docs): more i18n --- cspell.config.yaml | 2 ++ docs/.vitepress/components/BlogPosts.vue | 32 +++++++++++-------- docs/uno.config.ts | 4 +++ packages/i18n/src/locales/en/docs/theme.yaml | 12 +++++++ .../i18n/src/locales/zh-Hans/docs/theme.yaml | 17 ++++++++++ 5 files changed, 53 insertions(+), 14 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index ad68f6e4c..cb74a1e05 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -62,11 +62,13 @@ words: - defu - demi - demodel + - devlog - devlogs - directml - dokidoki - dotenvx - DownloadLive2DSDK + - dreamlog - dtolnay - dtype - dtypes diff --git a/docs/.vitepress/components/BlogPosts.vue b/docs/.vitepress/components/BlogPosts.vue index 1a78581fe..56f5ef39e 100644 --- a/docs/.vitepress/components/BlogPosts.vue +++ b/docs/.vitepress/components/BlogPosts.vue @@ -5,6 +5,7 @@ import { computedAsync } from '@vueuse/core' import { subtle } from 'uncrypto' import { useData } from 'vitepress' import { computed, ref } from 'vue' +import { useI18n } from 'vue-i18n' interface Post { title: string @@ -24,17 +25,19 @@ const props = defineProps<{ data: Post[] }>() +const { t } = useI18n() const { isDark } = useData() -const category = ref('All') +const category = ref('all') const categories = computed(() => { - const allCategories = props.data.map(post => post.frontmatter?.category).filter(Boolean) - return ['All', ...new Set(allCategories as string[])] + const allCategories = props.data.map(post => post.frontmatter?.category).filter(Boolean).map(post => post?.toLowerCase()) + return ['all', ...new Set(allCategories as string[])] }) const posts = computed(() => { - if (category.value && category.value !== 'All') { - return props.data.filter(post => post.frontmatter?.category === category.value).filter(post => !!(post.frontmatter as any)?.title) + if (category.value && category.value !== 'all') { + return props.data.filter(post => post.frontmatter?.category?.toLowerCase() === category.value).filter(post => !!(post.frontmatter as any)?.title) } + return (props.data as Post[]).filter(post => !!(post.frontmatter as any)?.title) }) @@ -131,6 +134,7 @@ ${patternElements} const svgArts = computedAsync(async () => { return Promise.all(posts.value.map(async (post) => { const generator = await createTileGenerator(post.title) + return { light: generator.generate({ dark: false }), dark: generator.generate({ dark: true }), @@ -143,29 +147,29 @@ const svgArts = computedAsync(async () => {

- Blog & DevLogs + {{ t('docs.theme.blog.title') }}

- Follow our journey and get the latest updates from the development team. + {{ t('docs.theme.blog.subtitle') }}

@@ -200,7 +204,7 @@ const svgArts = computedAsync(async () => {
- Read more + {{ t('docs.theme.blog.card.post.read-more.title') }}
@@ -208,7 +212,7 @@ const svgArts = computedAsync(async () => {

- No posts found in this category. + {{ t('docs.theme.blog.no-posts') }}

diff --git a/docs/uno.config.ts b/docs/uno.config.ts index d8287126c..00c386c55 100644 --- a/docs/uno.config.ts +++ b/docs/uno.config.ts @@ -73,6 +73,10 @@ export default defineConfig({ '[&_span_>_span]:focus:outline', ], theme: { + fontFamily: { + 'sans': `ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`, + 'sans-rounded': `"DM Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";`, + }, colors: { border: 'hsl(var(--border))', input: 'hsl(var(--input))', diff --git a/packages/i18n/src/locales/en/docs/theme.yaml b/packages/i18n/src/locales/en/docs/theme.yaml index 8b156757e..d4a3a9103 100644 --- a/packages/i18n/src/locales/en/docs/theme.yaml +++ b/packages/i18n/src/locales/en/docs/theme.yaml @@ -34,3 +34,15 @@ navbar: pages: characters: title: Characters +blog: + title: Blog & DevLogs + subtitle: Follow our journey and get the latest updates from the development team. + card: + post: + read-more: + title: Read more + no-posts: No posts found in this category. + categories: + all: All + devlog: DevLog + dreamlog: DreamLog diff --git a/packages/i18n/src/locales/zh-Hans/docs/theme.yaml b/packages/i18n/src/locales/zh-Hans/docs/theme.yaml index 392ae0d1b..5ecf7326d 100644 --- a/packages/i18n/src/locales/zh-Hans/docs/theme.yaml +++ b/packages/i18n/src/locales/zh-Hans/docs/theme.yaml @@ -27,3 +27,20 @@ search: navbar: appearance: title: 主题 + language: + title: 语言 +pages: + characters: + title: 角色 +blog: + card: + post: + read-more: + title: 阅读更多 + no-posts: 该分类下没有找到任何文章 + subtitle: 和我们一起旅行!阅读从开发团队发布的最新进展 + title: 文章 & 开发日志 + categories: + all: All + devlog: DevLog + dreamlog: DreamLog