def get_language_parameter ( request , query_language_key = 'language' , object = None , default = None ) : # This is the same logic as the django-admin uses. # The only difference is the origin of the request parameter. if not is_multilingual_project ( ) : # By default, the objects are stored in a single static language. # This makes the transition to multilingual easier as well. # The default language can operate as fallback language too. return default or appsettings . PARLER_LANGUAGES . get_default_language ( ) else : # In multilingual mode, take the provided language of the request. code = request . GET . get ( query_language_key ) if not code : # forms: show first tab by default code = default or appsettings . PARLER_LANGUAGES . get_first_language ( ) return normalize_language_code ( code )
how to make sure input language is english in a python form
Get the language parameter from the current request .
def get_language_parameter(request, query_language_key='language', object=None, default=None):
    """
    Get the language parameter from the current request.
    """
    # This is the same logic as the django-admin uses.
    # The only difference is the origin of the request parameter.
    if not is_multilingual_project():
        # By default, the objects are stored in a single static language.
        # This makes the transition to multilingual easier as well.
        # The default language can operate as fallback language too.
        return default or appsettings.PARLER_LANGUAGES.get_default_language()
    else:
        # In multilingual mode, take the provided language of the request.
        code = request.GET.get(query_language_key)

        if not code:
            # forms: show first tab by default
            code = default or appsettings.PARLER_LANGUAGES.get_first_language()

        return normalize_language_code(code)