How to use the @lingui/core.i18n._ function in @lingui/core

To help you get started, we’ve selected a few @lingui/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / lingui__core / lingui__core-tests.ts View on Github external
i18n,
    setupI18n,
    Catalog,
    Catalogs,
    MessageOptions,
    LanguageData,
    I18n,
    date,
    number,
    i18nMark
} from '@lingui/core';

const age = 12;
const templateResult: string = i18n.t`${age} years old`;
const templateIdResult: string = i18n.t('templateId')`${age} years old`;
const translateResult: string = i18n._('age', { age }, { defaults: '{age} years old' });

const count = 42;

const pluralResult: string = i18n.plural({
    value: count,
    0: 'no books',
    one: '# book',
    other: '# books'
});
const pluralIdResult: string = i18n.plural('pluralId', {
    value: count,
    0: 'no books',
    one: '# book',
    other: '# books'
});