Skip to content

Instantly share code, notes, and snippets.

@davidchambers
Created July 1, 2012 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidchambers/3029619 to your computer and use it in GitHub Desktop.
Save davidchambers/3029619 to your computer and use it in GitHub Desktop.
Attach language codes to request object
(req, res) ->
# Attach language codes to request object.
h = req.headers['accept-language']
req.languages = h and (/[^\s;-]+/.exec(l)[0] for l in h.split ',') or []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment