Guides  ›  Language  ›  Language selection ← PREV NEXT →

Language selection

Language selection checks the URL prefix, then the lang cookie, then the default.

function handler(state) {
  state.req.cookie('lang', 'no')
  return state.redirect('/no')
}

Recognized two-letter prefixes such as /no and /no/about set state.req.lang. Define routes for those exact paths; the prefix is not removed during matching. The cookie affects the next request.

Next: Localized routes →

Tools for business systems.