对于 nuxt3 i18n 有没有办法 :to 来实现嵌套和翻译路由? 例如 而不是
<NuxtLink :to="`${localePath('ser')}/${$t('est')}/${$t('pro')}`">
类似这样的事情
<NuxtLink :to="`${localePath('ser/est/pro')}`">
以及页面设置中
<script setup>
const route = useRoute()
console.log("route.params-----------", route)
defineI18nRoute({
paths: {
en: "/ser/est/pro",
nl: "/die/scha/ggg",
fr: "/ser/dev/pp",
fa: "rr/خ/تخ"
}
})
</script>
?
你的意思是这样的吗?
<nuxt-link
:to="localePath({
name: 'category-slug',
params: { slug: category.slug }
})"
>
{{ category.title }}
</nuxt-link>
配置如下:
i18n: {
customRoutes: 'config',
pages: {
'category/[slug]': {
// params need to be put back here as you would with Nuxt Dynamic Routes
// https://nuxt.com/docs/guide/directory-structure/pages#dynamic-routes
it: '/categoria/[slug]'
// ...
},
}
这就是你的意思吗?