A Localization Middleware For NodeJS
npm install locals --save
Locals currently only supports translations but in the future will support many more features. (see TODO).
var locals =localsdir: "../locals"baselanguage: "en";locals;
Locals utilizes a Folder and Json based hierarchy for loading and translating locale data. Locale data can then be used to translate text from a given language to any other given language. Locals uses the 2 digit ISO standard for language designation. All locals are created manually by the author as only a basic local demonstration set has been added to this release.
Locals uses folders to load locale data. The follow folder structure is used in creation of a base language to translate from:
Where each language folder is a 2 digit ISO representation of the main language to translate from.
Each locale folder may contain any other 2 digit ISO representation of a secondary language to translate to represented as a json file:
Where each json file represents the locale to translate to from the parent folders locale.
For direct reference see the examples folder within the package or on github.
- Distance Lookups
- Geo Targeting
- Planetary Data Locations
- Currency Conversions
We encourage forking. Feel free to fork & pull your new additions, or bug fixes.