Sudoo-Internationalization

Continuous Integration codecov npm version downloads

I18n

Install

yarn add @sudoo/internationalization
# Or
npm install @sudoo/internationalization --save

Usage

import { LOCALE, SudooFormat, SudooInternationalization } from "@sudoo/internationalization";

const i18n: SudooInternationalization = SudooInternationalization.create(LOCALE.ENGLISH_UNITED_STATES);
i18n.set(LOCALE.ENGLISH_UNITED_STATES, {
    simple: 'foo bar {}',
    named: 'foo bar {value}',
});

const formatter: SudooFormat = i18n.format(LOCALE.ENGLISH_UNITED_STATES);

console.log(formatter.get('simple', 2000)); // foo bar 2000
console.log(formatter.get('named', {
    value: 2000,
})); // foo bar 2000

This document is working in progress, for all usage features, see source code.