jeresig / i18n-node-2

Lightweight simple translation module for node.js / express.js with dynamic json storage. Uses common __('...') syntax in app and templates.
MIT License
507 stars 79 forks source link

lower case for preferred locale #32

Closed peecky closed 9 years ago

peecky commented 10 years ago

The preferredLocale() function did not always return locale in lower case. This may conflict with using other functions together, such as setLocaleFromQuery() and setLocaleFromCookie(). So I changed it to return always lower case.

Also, I removed unnecessary loops. When my web browser sent headers["accept-language"] == 'ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4', the while loop in the preferredLocale() function looped four times even the ko was matched on the first loop.