get_language_from_request
Analyzes the request to find the language the user wants the system to show.
def get_language_from_request(
request: HttpRequest,
check_path: boolean = False
) - > string
Determines the preferred language for the current request by inspecting the request object and optionally the URL path.
Parameters
| Name | Type | Description |
|---|---|---|
| request | HttpRequest | The incoming HTTP request object containing headers, cookies, and session data used for language discovery. |
| check_path | boolean = False | Whether to examine the URL path prefix to determine the requested language. |
Returns
| Type | Description |
|---|---|
string | The language code identified from the request, such as 'en' or 'fr', used to set the translation context. |