I am trying to get language choices from HTML head ACCEPT-LANGUAGE header. I have used parse_accept_lang_header() module for this. But its returning me all the language code in small character. like this [('pt-pt', 1.0), ('pt-br', 0.8), ('en-us', 0.5), ('en', 0.3)]
But I want to get like first one in small character, second part in uppercase corrector. Like this [('pt-PT', 1.0), ('pt-BR', 0.8), ('en-US', 0.5), ('en', 0.3)]
. So how can I do so?
My code is as following:
from django.utils.translation.trans_real import parse_accept_lang_header
header_locales =parse_accept_lang_header(
request.META.get('HTTP_ACCEPT_LANGUAGE', None))
the header_locales
return me the locale name in small charector.