def get_first_lang ( ) : request_lang = request . headers . get ( 'Accept-Language' ) . split ( ',' ) if request_lang : lang = locale . normalize ( request_lang [ 0 ] ) . split ( '.' ) [ 0 ] else : lang = False return lang
how to get firstname in language python
Get the first lang of Accept - Language Header .
def get_first_lang():
    """Get the first lang of Accept-Language Header.
    """
    request_lang = request.headers.get('Accept-Language').split(',')
    if request_lang:
        lang = locale.normalize(request_lang[0]).split('.')[0]
    else:
        lang = False
    return lang