fix: categories i18n display

This commit is contained in:
YunYouJun 2025-07-13 19:14:39 +08:00
parent 00ed99b171
commit d7dc38d0b3
5 changed files with 15 additions and 5 deletions

View File

@ -5,7 +5,7 @@ excerpt:
ai: AI-Generated Excerpt
siteConfig:
title: Site Config Title
title: Custom Blog Name
subtitle: Next Generation Static Blog Framework.
description: Valaxy Theme Yun Preview
author:

View File

@ -1,5 +1,7 @@
---
title: Code Block Test
title:
en: Code Block Test
zh-CN: 代码块测试
categories:
- $locale:category.test
---

View File

@ -1,5 +1,7 @@
---
title: 赞助者
title:
en: Sponsors
zh-CN: 赞助者
---
## [Sponsors](https://www.yunyoujun.cn/sponsors/)

View File

@ -1,9 +1,12 @@
<script lang="ts" setup>
import type { Post } from 'valaxy'
import { useValaxyI18n } from 'valaxy'
defineProps<{
categories: Post['categories']
}>()
const { $t } = useValaxyI18n()
</script>
<template>
@ -19,7 +22,7 @@ defineProps<{
>
<div m="x-1" inline-flex i-ri-folder-2-line />
<span>
{{ Array.isArray(categories) ? categories.join(' / ') : categories }}
{{ Array.isArray(categories) ? categories.map($t).join(' / ') : $t(categories || '') }}
</span>
</RouterLink>
</template>

View File

@ -1,9 +1,12 @@
<script lang="ts" setup>
import type { Post } from 'valaxy'
import { useValaxyI18n } from 'valaxy'
defineProps<{
tags: Post['tags']
}>()
const { $t } = useValaxyI18n()
</script>
<template>
@ -19,7 +22,7 @@ defineProps<{
border
hover="bg-blue-500 text-white"
>
<span>{{ tag }}</span>
<span>{{ $t(tag) }}</span>
</RouterLink>
</div>
</template>