Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

basic plain vanilla setup in node with http

View i18n-node-http.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// require modules
var http = require('http'),
i18n = require('i18n'),
app;
 
// minimal config
i18n.configure({
locales: ['en', 'de'],
directory: __dirname + '/locales'
});
 
// simple server
app = http.createServer(function (req, res) {
// init & guess, see hepler below
i18n.init(req, res);
res.end(res.__('Hello'));
});
 
 
// startup
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.