node-polyglot-middleware
express middleware for node-polyglot (polyglot.js from airbnb)
Installation
$ npm install --save node-polyglot-middleware
Usage
- node-polyglot-middleware prioritize static phrases (options.phrases) over callback function (options.getPhrases)
- do not provide static phrases if you want to fetch phrases dynamically using callback function
var polyglot = ;var express = ;var app = ; var options = phrases: // using static phrases hello: 'Hello' { request; }; // using static phrasesapp; // fetching phrases dynamicallyapp; // when you have to use req paramapp; // after polyglot middleware is specified,// you can use req.polyglot in the following middlewares and routersrouter;
License
MIT © Dongwon Lim