Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

i18n-node in an restify app setup

View i18n-restify-app.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// require modules
var restify = require('restify'),
i18n = require('i18n'),
app;
 
// minimal config
i18n.configure({
locales: ['en', 'de'],
directory: __dirname + '/locales'
});
 
// Create the RESTify server
app = restify.createServer();
 
// enable i18n in restify
app.use(i18n.init);
 
// setup a simple resource
app.get('/test', function (req, res, next) {
res.send(200, {
'somevartoreturn': res.__('Hello')
});
return next();
});
 
// Start the app!
app.listen(3000, '127.0.0.1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.