I'm building an Angular2 Universal app and I'm integrating ng2-translate.
Server side I need to know the language of the user, which I could get from ExpressJS via request.acceptsLanguages()
(see docs).
I do correctly get these values in server.ts
like so:
function ngApp(req: any, res: any) {
let supportedLangs = req.acceptsLanguages();
console.log('supportedLangs', supportedLangs);
res.render('index', {
req,
res,
ngModule: AppModule,
preboot: false,
baseUrl: '/',
requestUrl: req.originalUrl,
originUrl: req.hostname
});
}
Then I don't know how to pass them, or access them, in my app.node.module.ts
where I set up ng2-translate
for the server.
Is there a way to access these values from the Angular Universal app (server side)? How?