Keyboard shortcut: Ctrl + K
Get started

Localisation (i18n)

Vectis UI uses English messages and the en-US locale by default. Register the supplied French dictionary or add your own translations.

Dictionaries provide interface text. The locale also controls regional formats through Intl. If no dictionary is registered for a language, messages fall back to English while formatting uses the selected locale.

Change language

Import and register the French dictionary, then select a locale with setLocale:

ts
import { fr, registerMessages, setLocale } from 'vectis-ui'

registerMessages('fr', fr)
setLocale('fr-FR')

Register dictionaries when your application starts, in main.ts or a universal Nuxt plugin. Call setLocale to update component messages and default formats without reloading the page.

The locale is shared across the process. For concurrent SSR requests in different languages, pass explicit text and locale props to components. For static generation, render routes sequentially and set the locale before rendering each route.

Add a language

Register a dictionary under its language code, such as de. Partial dictionaries keep previously registered values for omitted keys, then fall back to English.

ts
import { registerMessages, setLocale, type MessagesInput } from 'vectis-ui'

// Omitted keys use the English messages for this new dictionary.
const de: MessagesInput = {
  common: { clear: 'Leeren', close: 'Schließen' },
  dataTable: { empty: 'Keine Daten' },
}

registerMessages('de', de)
setLocale('de-DE')

Use MessagesInput to check namespace names, keys and message parameters. Dictionaries have two levels: namespace and key.

en-GB and en-US share the en dictionary but use different regional formats. Component text props, such as loadingText, override the corresponding dictionary messages.

Language and formats

Use setLocale for the global language and default formats. On components that accept it, the locale prop overrides formats without changing dictionary messages. In this example, choose the language and date/time formats separately.


Translation keys

The table lists the English messages by namespace. Register only the keys you want to translate or override.

Parameterised messages are TypeScript functions, shown with their arguments below. Implement plural rules in these functions.

KeyEnglish value
common.loadingLoading…
common.clearClear
common.closeClose
common.dismissRemove
common.remove(name) => `Remove ${name}`
common.cancelCancel
common.confirmOK
pagination.labelPagination
pagination.firstFirst page
pagination.previousPrevious page
pagination.nextNext page
pagination.lastLast page
pagination.page(page) => `Page ${page}`
tabs.labelTabs
tabs.previousPrevious tabs
tabs.nextNext tabs
breadcrumb.labelBreadcrumb
breadcrumb.ellipsisShow intermediate pages
sideNavigation.labelNavigation
link.newTab, opens in a new tab
combobox.emptyNo results
combobox.clearClear selection
combobox.create(query) => `Create "${query}"`
select.clearClear selection
commandPalette.labelCommand palette
commandPalette.searchLabelSearch commands
commandPalette.placeholderType a command or search…
commandPalette.emptyNo results
commandPalette.navigateNavigate
commandPalette.chooseSelect
dataTable.emptyNo data
dataTable.noResultsNo results
dataTable.loadingLoading data…
dataTable.searchLabelSearch the table
dataTable.searchPlaceholderSearch…
dataTable.perPageRows per page
dataTable.perPageValue(label, value) => `${label}: ${value}`
dataTable.selectAllSelect all
dataTable.selectRow(index) => `Select row ${index}`
dataTable.selection(count) => `${count} item${count === 1 ? '' : 's'} selected`
dataTable.range({ start, end, total }) => `${start}–${end} of ${total}`
dataTable.paginationTable pagination
toaster.labelNotifications
snackbar.labelConfirmation
snackbar.actionUndo
inputOTP.labelVerification code
inputOTP.slot(index, total) => `Character ${index} of ${total}`
slider.valueValue
slider.startStart
slider.endEnd
slider.rangeStart(label) => `${label} (start)`
slider.rangeEnd(label) => `${label} (end)`
field.limitExceeded(max) => `Exceeds the limit of ${max} characters`
progress.percent(percent) => `${percent}%`
progress.labelProgress
meter.labelMeter
meterGroup.labelBreakdown
hotkeys.commandCommand
hotkeys.ctrlCtrl
hotkeys.altAlt
hotkeys.shiftShift
hotkeys.windowsWin
hotkeys.superSuper
hotkeys.enterEnter
hotkeys.escapeEsc
hotkeys.spaceSpace
hotkeys.backspaceBackspace
hotkeys.deleteDel
hotkeys.tabTab
hotkeys.upUp arrow
hotkeys.downDown arrow
hotkeys.leftLeft arrow
hotkeys.rightRight arrow
hotkeys.label(keys) => `Keyboard shortcut: ${keys}`
colorPicker.labelColour picker
colorPicker.saturationSaturation
colorPicker.brightnessBrightness
colorPicker.areaValue(saturation, brightness) => `Saturation ${saturation}, brightness ${brightness}`
colorPicker.hueHue
colorPicker.alphaOpacity
colorPicker.valueColour value
colorPicker.formatColour format
colorPicker.eyeDropperPick a colour from the screen
colorPicker.swatchesPreset colours
colorInput.clearClear colour
colorInput.openPickerOpen colour picker
colorInput.pickerLabelChoose a colour
datePicker.labelDate picker
datePicker.previousMonthPrevious month
datePicker.nextMonthNext month
datePicker.previousYearPrevious year
datePicker.nextYearNext year
datePicker.monthPickerChoose month
datePicker.yearPickerChoose year
dateInput.clearClear date
dateInput.openPickerOpen calendar
dateInput.pickerLabelChoose a date
numberInput.incrementIncrease
numberInput.decrementDecrease
splitButton.menuMore options
rating.labelRating
rating.emptyNo rating
rating.value(value, max) => `${value} out of ${max}`
resizable.panel(position) => `Panel ${position}`
stepper.labelProgress
stepper.completedCompleted
stepper.errorError
treeView.labelTree
treeView.loadFailedCould not load
treeView.loadError(label) => `Could not load the contents of ${label}`
timePicker.labelTime picker
timePicker.meridiemAM or PM
timePicker.amAM
timePicker.pmPM
timePicker.selectHourSelect hour
timePicker.selectMinutesSelect minutes
timePicker.choosingHourSelecting the hour
timePicker.choosingMinutesSelecting the minutes
timePicker.hourHour
timePicker.minutesMinutes
timePicker.hourValue(hour) => `${hour} o'clock`
timePicker.minutesValue(minute) => `${minute} minutes`
timeInput.clearClear time
timeInput.openPickerOpen time picker
timeInput.pickerLabelChoose a time
timeInput.meridiemValue(value) => `AM or PM: ${value}`
timeInput.maskPlaceholderhh:mm
timeInput.unavailableThis time is not available.
fileInput.openPickerChoose files
fileInput.clearClear files
fileInput.files(count) => `${count} file${count === 1 ? '' : 's'}`
fileInput.placeholderNo file selected
filePicker.browseBrowse files
filePicker.oror
filePicker.listSelected files
carousel.labelCarousel
carousel.roleDescriptioncarousel
carousel.slideRoleDescriptionslide
carousel.slidesSlides
carousel.slide(index, total) => `${index} of ${total}`
carousel.previousPrevious slide
carousel.nextNext slide
carousel.indicatorsChoose slide to display
calendar.labelCalendar
calendar.roleDescriptioncalendar
calendar.todayToday
calendar.viewView
calendar.viewDayDay
calendar.view4Days4 days
calendar.viewWeekWeek
calendar.viewMonthMonth
calendar.viewYearYear
calendar.viewCustom(days) => `${days} days`
calendar.previousDayPrevious day
calendar.nextDayNext day
calendar.previousWeekPrevious week
calendar.nextWeekNext week
calendar.previousMonthPrevious month
calendar.nextMonthNext month
calendar.previousYearPrevious year
calendar.nextYearNext year
calendar.previousPeriodPrevious period
calendar.nextPeriodNext period
calendar.allDayAll day
calendar.moreEvents(count) => `+${count} more`
calendar.openDay(day) => `Open ${day}`
calendar.untitled(No title)
calendar.eventRoleDescriptionevent
calendar.eventHintPress Enter to open this event. Press Space to take hold of it, then the arrow keys to move it and Shift with the arrow keys to change when it ends.
calendar.grabbedEvent held. Use the arrow keys to move it, Enter or Space to place it, Escape to cancel.
calendar.droppedEvent placed.
calendar.revertedMove cancelled. The event is back where it was.
calendar.movedTo(title, when) => `${title} moved to ${when}.`