localizify can work together with hapi.js.
Create new plugin which add middleware to set locale on current request:
const localizify = require('localizify');
exports.register = (server, options, next) => {
server.ext('onRequest', (request, reply) => {
const language = localizify.detectLocale(request.headers['accept-language']) || 'en';
localizify.setLocale(language);
return reply.continue();
});
next();
};
Register plugin:
server.register(PLUGIN_NAME);