i18n
locales and translation for Superset.
import { configure, t, tn } from '@superset-ui/core'; configure({ languagePack: {...}, }); console.log(t('text to be translated')); console.log(tn('singular text', 'plural text', value));
configure({ [languagePack] })
languagePack
is specified.t(text[, args])
text
.args
is provided, substitute args
into the sprintf
placeholders specified within text
translation.For example
t('Hello %(name)s', user);
See sprintf-js for more details on how to define placeholders.
tn(singular, plural, num, [, args])
singular
and plural
based on num
.args
is provided, substitute args
into the sprintf
placeholders specified within singular
or plural
translations.For example
tn('%d duck', '%d ducks', 2, 2);