May 07, 2021 Vant
Vant defaults to Chinese language, and if you need to use a different language, you can refer to the following scenario.
Vant implements multilingual support through the Locale component, using the Locale.use method to switch the language currently in use.
import { Locale } from 'vant';
import enUS from 'vant/lib/locale/lang/en-US';
Locale.use('en-US', enUS);
The Locale.add approach allows you to modify and extend your case, as follows:
import { Locale } from 'vant';
const messages = {
'zh-CN': {
vanPicker: {
confirm: '关闭' // 将'确认'修改为'关闭'
}
}
};
Locale.add(messages);
Languages currently supported:
Language | Filename |
---|---|
Chinese Simplified | zh-CN |
Complex Chinese (Hong Kong) | zh-HK |
Complex Chinese (Taiwan) | zh-TW |
English | en-US |
Turkish | tr-TR |
Spanish | es-ES |
See all i18n profiles here.
The language pack does not contain the language configuration of the Sku business component by default, so if you have internationalization requirements for the Sku component, configure your own internationalization documentation.