You can specify locale messages and a default locale for Vueless components and integrate it with vue-i18n as well.
Vueless i18n
Vueless supports only English locale by default. To set additional locales, you can provide them in createVueless() under the locale key with the structure below:
main.js
import { createVueless, defaultEnLocale } from"vueless";constvueless=createVueless({ i18n: { locale:"en",// default locale fallback:"en",// fallback locale messages: { en: { // customize or overwrite default english locale...defaultEnLocale, USelect: { // Vueless component name listIsEmpty:"List is empty.", noDataToShow:"No data to show.", clear:"clear", addMore:"Add more...", }, }, ua: { // new custom locale USelect: { // Vueless component name listIsEmpty:"Список порожній.", noDataToShow:"Дані відсутні.", clear:"очистити", addMore:"Додати ще...", }, }, }, },});
Full list of locale keys available in Vueless UI docs in Default config chapter (at the end of each page).
Vue-i18n integration
Use createVueI18nAdapter() to integrate vue-i18n library with Vueless components.
main.js
import { createVueless, defaultEnLocale, createVueI18nAdapter } from"vueless";import { createI18n } from"vue-i18n";consti18n=createI18n({ legacy:false,// legacy mode should be disabled locale:"ua",// default locale fallback:"en",// fallback locale messages: { en: { // customize or overwrite default english locale...defaultEnLocale, USelect: { // Vueless component name listIsEmpty:"List is empty.", noDataToShow:"No data to show.", clear:"clear", addMore:"Add more...", },// other project messages projectMessageOne:"Hello wrold!", projectMessageTwo:"Brave new world.", }, ua: { // new custom locale USelect: { // Vueless component name listIsEmpty:"Список порожній.", noDataToShow:"Дані відсутні.", clear:"очистити", addMore:"Додати ще...", },// other project messages projectMessageOne:"Привіт світ!", projectMessageTwo:"Прекрасний новий світ.", }, },});constvueless=createVueless({ i18n: { adapter:createVueI18nAdapter(i18n), },});
Changing current locale
If you use vue-i18n, you can change current locale using provided useI18n composable. To change current locale without vue-i18n use useLocale composable provided by Vueless.