Skip to main content

get_language_from_request

Returns the default language code from the application settings, regardless of the provided request or path check parameters.

def get_language_from_request(
request: HttpRequest,
check_path: boolean = False
) - > string

Retrieves the default language code from the application settings for the given request.

Parameters

NameTypeDescription
requestHttpRequestThe incoming HTTP request object used to determine the context for language resolution.
check_pathboolean = FalseWhether to inspect the URL path for language prefixes during the resolution process.

Returns

TypeDescription
stringThe ISO 639-1 language code defined in the project settings, such as "en-us".