Ant-design-pro: 🐛[v5版本怎样设置antD的语言为中文 ]

Created on 31 Jul 2020  ·  11Comments  ·  Source: ant-design/ant-design-pro

🐛 bug 描述

新拉的框架, 关闭国际化,配置

export const antd= {
    config:{
        locale:{}
    }
}

报错

© 版本信息

  • Ant Design Pro 版本: [e.g. 5.0.0]
  • umi 版本【3.2.13】
  • 浏览器环境 谷歌
  • 开发环境 [win10]

🚑 其他信息

image
image
image

🛑 bug

Most helpful comment

@569202812 这里的设计有点问题,配置中的 antd 的 config 配置了才会开启运行时配置。你需要在配置里面写上 antd:{config:{}}

配置了可以了, 日期还需要在app.tsx里面配置下
import 'moment/locale/zh-cn';

All 11 comments

为啥我看不到图?

为啥我看不到图?

看不到吗

“locale.antd: false” 就可以关闭国际化了

用 runtime 的写法

// src/app.ts
export const antd = {
  componentSize:'small'
}

用 runtime 的写法

// src/app.ts
export const antd = {
  componentSize:'small'
}

配置了后还是报错
image

@569202812 这里的设计有点问题,配置中的 antd 的 config 配置了才会开启运行时配置。你需要在配置里面写上 antd:{config:{}}

@569202812 这里的设计有点问题,配置中的 antd 的 config 配置了才会开启运行时配置。你需要在配置里面写上 antd:{config:{}}

配置了可以了, 日期还需要在app.tsx里面配置下
import 'moment/locale/zh-cn';

@569202812 这里的设计有点问题,配置中的 antd 的 config 配置了才会开启运行时配置。你需要在配置里面写上 antd:{config:{}}

配置了可以了, 日期还需要在app.tsx里面配置下
import 'moment/locale/zh-cn';

具体怎么配的能讲讲吗,看得我一脸懵逼

@569202812 这里的设计有点问题,配置中的 antd 的 config 配置了才会开启运行时配置。你需要在配置里面写上 antd:{config:{}}

配置了可以了, 日期还需要在app.tsx里面配置下
import 'moment/locale/zh-cn';

具体怎么配的能讲讲吗,看得我一脸懵逼

config 文件 添加antd:{config:{}}
app.tsx 文件 添加

import 'moment/locale/zh-cn';

export const antd= {
    config:{
        locale: zhCN // 引用antd的语言包
    }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jerry-goodboy picture Jerry-goodboy  ·  3Comments

yaoleiroyal picture yaoleiroyal  ·  3Comments

wuyongdec picture wuyongdec  ·  3Comments

renyi818 picture renyi818  ·  3Comments

ghost picture ghost  ·  3Comments