【问题标题】:Nuxt Lang attribute configNuxt Lang 属性配置
【发布时间】:2021-06-27 20:17:53
【问题描述】:

尝试用 nuxt 指定我的语言,

结果很奇怪:

<html lang="en" data-n-head="%7B%22lang%22:%7B%22ssr%22:%22en%22%7D%7D"><head>

配置很简单,但不起作用:

 head: {
  title: 'test',
   htmlAttrs: {
 lang: 'it',

},

有什么想法吗?

【问题讨论】:

    标签: nuxt.js nuxt-i18n


    【解决方案1】:

    您是否可能一起使用 Nuxt PWA 模块? 如果是这样,您还需要在 PWA 模块设置中配置语言设置。

    pwa: {
      manifest: {
        lang: 'it',
      }
    }
    
    
    

    【讨论】:

      【解决方案2】:

      根据这个answer 应该可以工作(手头没有 nuxt 可以尝试)。你导出正确吗,在nuxt.config.js,对吧?

      module.exports = {
        head: {
          htmlAttrs: { lang: 'en' },
          title: 'awesome title',
      ...
      

      【讨论】:

      • 我尝试了同样的问题 module.exports = { head: { title: 'test', htmlAttrs: { lang: 'it', },
      猜你喜欢
      • 2018-06-22
      • 2018-08-03
      • 2016-01-14
      • 2016-05-13
      • 2016-03-13
      • 1970-01-01
      • 1970-01-01
      • 2011-05-18
      • 2020-11-07
      相关资源
      最近更新 更多