Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果在 url 中找不到,我想将后备语言参数推送到每条路线
例如,当我输入:/page 路由器应该将我重定向到:/en/page
我怎么能用 nuxt 和 i18n 做到这一点......?
添加strategy: "default"到您的i18n配置中nuxt.config.js,使其看起来像这样:
strategy: "default"
i18n
nuxt.config.js
//nuxt.config.js i18n: { strategy: "default" }
现在,如果您的路线中没有defaultLocale语言参数,则会自动将语言参数添加到您的网址中。
defaultLocale