message-interpolation
v1.1.0
Published
The process of formatting messages for internationalization.
Downloads
110
Readme
Message Interpolation
The process of formatting messages for internationalization.
Install
$ npm i message-interpolation
# or
$ yarn add message-interpolation
# or
$ pnpm i message-interpolation
# or
$ bun add message-interpolation
Usage
import mi from 'message-interpolation';
/**
* Named interpolation
*/
const msg = `{say}, World!`;
mi(msg, { say: 'Hello' });
// Hello, World!
/**
* List interpolation
*/
const alphabet = `{0} B {1} D {2} F G`;
mi(alphabet, ['A', 'C', 'E']);
// A B C D E F G