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

Why convert locales to lowercase in methods like setLocaleFromQuery()? #88

Open leohihimax opened 8 years ago

leohihimax commented 8 years ago

Some methods like setLocaleFromQuery(), setLocaleFromCookie() will convert the locale to lower case. I see a lot of projects use uppercase letter in their i18n locales file name like en-US.json, zh-CN.json. Also, the accept language in HTTP request header use the uppercase letter in the locale like en,zh-CN;q=0.8,zh;q=0.6. So my question is why those methods convert locales to lowercase? Why not just keep the original case?

gjuchault commented 8 years ago

Maybe @jeresig can answer to this (he wrote/forked this code)

holm commented 8 years ago

I've just run into the same problem after upgrading. We use uppercase for the country part, which now means it won't match f.ex. zh-CN. Not sure how this could be resolved, but ideally it would case-insensitive.