Internationalization
The i18n service provides a way to update internalized aria-* attributes for multi-language support. Outside of internalized aria-* attributes you can update strings directly in the DOM via slotted content using the i18n solution of your application.
Global
The I18nService service can both read and override the default component strings for all components globally.
import { I18nService } from '@nvidia-elements/core';
// get values
I18nService.i18n
// update values
I18nService.update({
close: 'fermer',
expand: 'étendre',
sort: 'classer',
show: 'montrer',
hide: 'cacher',
loading: 'bourrage'
});
Component
Components may need to provide context to the action they are describing. For example, a dialog can have a specific close label.
Using the i18n property/attribute, the i18n values can be overridden per component instance rather than across the entire application.
<nve-dialog closable nve-i18n="{ 'close': 'dismiss task failure warning'}">
Warning, pending task failed, <a href="#">retry task</a>?
</nve-dialog>