Skip to content

Internationalization - Vant 4

Internationalization ​

Intro ​

Vant uses Chinese as the default language. If you want to use other languages, please follow the instructions below.

Usage ​

Switch languages ​

Vant supports multiple languages with the Locale component, and the Locale.use method allows you to switch to different languages.

js
import { Locale } from'vant'; import enUS from'vant/es/locale/lang/en-US'; Locale.use('en-US', enUS);

Override default configs ​

Use Locale.add method to modify the default configs.

js
import { Locale } from'vant'; const messages = { 'en-US': { vanPicker: { confirm: 'Close', }, }, }; Locale.add(messages);

Config files ​

Current supported languages:

LanguageFilenameVersion
Arabicar-SAv3.5.0
Bulgarianbg-BGv3.5.0
Bangla (Bangladesh)bn-BDv3.4.5
Danishda-DKv3.4.8
Germande-DE-
German (formal)de-DE-formal-
Greekel-GRv3.5.0
Englishen-US-
Esperantoeo-EOv4.0.9
Spanish (Spain)es-ES-
Farsifa-IRv3.5.0
Frenchfr-FR-
Hebrewhe-ILv3.5.0
Hindihi-INv3.4.3
Indonesianid-IDv3.4.5
Icelandicis-ISv3.4.7
Italianit-ITv3.4.5
Japaneseja-JP-
Kazakhkk-KZ-
Khmerkm-KHv4.1.2
Koreanko-KRv3.4.3
Laola-LAv3.4.7
Mongolianmm-MNv4.0.5
Norwegiannb-NO-
Dutchnl-NLv4.0.5
Polishpl-PLv4.9.17
Portuguese (Brazil)pt-BRv3.3.3
Romanianro-RO-
Russianru-RUv3.1.5
Serbiansr-RSv4.6.4
Swedishsv-SEv3.4.7
Thaith-TH-
Turkishtr-TR-
Ukrainianuk-UAv3.4.5
Vietnamesevi-VNv3.4.5
Chinesezh-CN-
Traditional Chinese (HK)zh-HK-
Traditional Chinese (TW)zh-TW-

View all language configs Here.

Add new language ​

If you can’t find the language you need, please send us a Pull Request to add the new language pack, you can refer to Add German language pack PR.

Get Current Lang ​

You can get the current language using useCurrentLang method.

  • Type:
ts
functionuseCurrentLang(): Ref<string>;
  • Example:
ts
import { useCurrentLang } from'vant'; const currentLang = useCurrentLang(); console.log(currentLang.value); // --> 'en-US'

Enterprise-level mobile solution based on Vant