Internationalization (i18n)
Every user-facing string in @bquery/ui goes through the i18n system.
Setting a Locale
typescript
import { setLocale } from '@bquery/ui/i18n';
setLocale({
dialog: {
close: 'Schließen',
confirm: 'Bestätigen',
cancel: 'Abbrechen',
},
toast: {
close: 'Benachrichtigung schließen',
},
pagination: {
prev: 'Zurück',
next: 'Weiter',
},
});Getting the Current Locale
typescript
import { getLocale } from '@bquery/ui/i18n';
const locale = getLocale();
console.log(locale.dialog.close); // 'Schließen'Using the t() Function
typescript
import { t } from '@bquery/ui/i18n';
t('dialog.close'); // 'Schließen'
t('input.characterCount', { count: 5, max: 100 }); // '5 of 100 characters'Full Locale Reference
typescript
export interface BqLocale {
common: { close, open, loading, error, success, warning, info, required, optional, clear, search, noResults };
dialog: { close, confirm, cancel, ariaLabel };
toast: { close, success, error, warning, info };
pagination: { prev, next, page, of, nav, goToPage, firstPage, lastPage };
input: { showPassword, hidePassword, clearValue, characterCount };
select: { placeholder, noOptions, clearSelection, openMenu };
table: { sortAscending, sortDescending, noData, loading, rowsPerPage };
accordion: { expand, collapse };
tabs: { listLabel };
slider: { ariaLabel, valueText };
emptyState: { title, description };
chip: { remove };
drawer: { close };
}