f-locale
Localization helper for f-promise
f-locale
is a companion package for f-promise
.
It provides a small helper to manage localized messages.
Installation
npm install --save f-locale
Usage
Resources must be placed in JSON files inside a resources
subdirectory of the current directory:
source-folder/ resources/ module1-en.json module1-fr.json ... module2-en.json module2-fr.json ... module1.ts module2.ts
The JSON files contain a simple object hash:
f-locale
uses handlebars formatting directives.
Basic usage:
;const resources = locale; // setting the localelocalecurrent = 'fr';// loading a simple messageconsole;// formating a parameterized messagecconsole;
License
MIT.