Follow this steps to reproduce:
- Create a new wiki page with this content:
- Configure your browser to ask for Brazilian Portuguese language
- Clear the existing cookies
- Access the wiki page created in the first step
You get 'pt' although we would expect 'pt_BR'.
You can check the HTTP headers of the request. I got:
so 'pt-BR' is included as first option.
The problem comes from XWiki.getAcceptedLanguages() which keeps only the language code (ignoring the country code).