Skip to content

This library give you simple interface to work with intl.js and intl-messageformat.

Notifications You must be signed in to change notification settings

igogo5yo/node-intl

Repository files navigation

NodeIntl

Build Status NPM NPM

This library give you simple interface to work with intl.js and intl-messageformat.

Usage

Install the package via NPM: npm i node-intl.

 const intl = NodeIntl.instance; // Create instance

 intl.locale = 'ru-RU'; // set locale

 intl.messages = {...}; // set messages

 intl.addMessages({...}); // add new messages

 intl.addMessagesFromFile('path/to/file'); // add new messages from file

 intl.formatMessage('device.name', {prop: 'Name'}); // format messages