Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dumi版本2.2.6,在ant-design-pro项目中使用dumi搭建文档,怎么配置locales文件目录? #1851

Closed
penglittlebai opened this issue Aug 23, 2023 · 1 comment
Labels
question Further information is requested

Comments

@penglittlebai
Copy link

Question

ant-design-pro项目中组件用到了国际化,dumi搭建文档引用改组件时,提示 export 'useIntl' (imported as 'useIntl') was not found in 'umi' ,
于是在.dumirc.ts 添加了插件 和 添加 locale配置 :
plugins: [
'@umijs/plugins/dist/locale',
],
locale: {
default: 'zh-CN',
},

此时页面可以正常打开了,但是由于匹配不到正确的locales国际化配置文件,导致组件显示的 国际化id名称,例如 “publicComponents.table.query”
image

同时 dumi框架自身相关的文字也变成了 国际化id名称,例如顶部搜索的placeholder显示 “header.search.placeholder”
image

Sample Code

@penglittlebai penglittlebai added the question Further information is requested label Aug 23, 2023
@penglittlebai penglittlebai changed the title 在ant-design-pro项目中使用dumi搭建文档,怎么配置locales文件目录? dumi版本2.2.6,在ant-design-pro项目中使用dumi搭建文档,怎么配置locales文件目录? Aug 23, 2023
@PeachScript
Copy link
Member

这个组合应该是不被支持的,分两点说明下:

  1. dumi 虽然同属 Umi 体系,但不是所有 Umi 体系的插件都可以在 dumi 中使用的,其中 locale 插件就是不能用的,因为 dumi 内部也有 react-intl,和插件内置的 react-intl 会冲突
  2. dumi 2 目前只提供独立运行模式,无法像 dumi 1 的应用集成模式一样与 Umi 应用一起使用

如果你的初衷是为了管理应用内的组件,那么目前没有最佳实践,加上 dumi 也不支持依赖 Umi 框架能力的组件研发(即源码里存在 import xxx from 'umi'),所以这个问题是没有解决方案的

@PeachScript PeachScript closed this as not planned Won't fix, can't repro, duplicate, stale Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants