This approach of parsing the accept-language header is over-simplified. You can look here for documentation: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html and here for 2 possible implementations you can use: https://github.com/niclashoyer/http-accept, 
https://github.com/jed/locale (you can also find both of them on npm).