Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Vant International


May 07, 2021 Vant


Table of contents


Introduced

Vant defaults to Chinese language, and if you need to use a different language, you can refer to the following scenario.

Multi-language switching

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);

Modify the default document

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);

Profile

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.

Sku component

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.


Example demonstration