get_language_from_path
Return the language code if there's a valid language code found in path.
If strict is False (the default), look for a country-specific variant
when neither the language code nor its generic variant is found.
def get_language_from_path(
path: string,
strict: boolean = False
) - > string
Return the language code if there's a valid language code found in path.
If strict is False (the default), look for a country-specific variant
when neither the language code nor its generic variant is found.
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | The URL path or file path string to be inspected for a language code prefix |
| strict | boolean = False | Determines whether to strictly match the language code or allow falling back to country-specific variants |
Returns
| Type | Description |
|---|---|
string | The validated language code string if a match is found and supported, otherwise None |