fix #1399: Lowercase lang codes before comparing

Err, there *might* be a better way to do this, hence the PR. But basically, the problem is sometimes we get 'pt-BR' for `request.language` and `pt-br` for `lang_code`. Bring them first to lowercase before comparing.