I went from the thing that I18n.available_locales is an array of symbols. So we have to choose whether convert accept_language to symbol or convert available_locales to string. I chose first, but I'm open to discussion.
The second thing: the second (optional) part of local is not always uppercase - many browsers send it like "en-ca", "pt-br". But you are right I forgot to add "i" modifier for this regexp. Will make a fixing PR.
Thank you for your reviews, they are helping a lot.