Skip to content

In ant-design-vue2, typescript, vue-i18n@9.0, some internationalization errors are reported when the parameter messages are set. Chinese, Japanese, and traditional Chinese do not report errors, but English errors are reported. I don’t know if it’s a problem with my configuration. #3783

@whustle

Description

@whustle
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.1

Environment

windows7 谷歌 vue3 typescript ant-design-vue2 vue-i18n@9.0

Reproduction link

https://vuecomponent.github.io/

Steps to reproduce

引入英文国际化文件

import antEn from 'ant-design-vue/es/locale-provider/en_US'
创建i18n对象时,messages处报错

const i18n = createI18n({
locale: defaultLocale,
fallbackLocale: defaultLocale,
messages
});

What is expected?

ant-design-vue组件国际化,切换中英文

What is actually happening?

国际化报错


import antEn from 'ant-design-vue/es/locale-provider/en_US'
const messages = {
en_US: {
antLocale: antEn
},
zh_CN: {
antLocale: antZH
}
};
//messages报错,引入英文国际化文件的问题,中文的没有问题
const i18n = createI18n({
locale: defaultLocale,
fallbackLocale: defaultLocale,
messages
});

不能将类型“{ en_US: { antLocale: { locale: string; Pagination: { items_per_page: string; jump_to: string; jump_to_confirm: string; page: string; prev_page: string; next_page: string; prev_5: string; next_5: string; prev_3: string; next_3: string; }; ... 12 more ...; PageHeader: { ...; }; }; }; zh_CN: { ...; }; }”分配给类型“LocaleMessages<VueMessageType>”。
属性“en_US”与索引签名不兼容。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions