UNPKG

i18next-http-middleware

Version:

i18next-http-middleware is a middleware to be used with Node.js web frameworks like express or Fastify and also for Deno.

20 lines (15 loc) 452 B
export default { name: 'session', lookup (req, res, options) { let found if (options.lookupSession !== undefined && typeof req && options.getSession(req)) { found = options.getSession(req)[options.lookupSession] } return found }, cacheUserLanguage (req, res, lng, options = {}) { if (options.lookupSession && req && options.getSession(req)) { options.getSession(req)[options.lookupSession] = lng } } }