This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LanguageMiddleware(object): | |
""" | |
Detect the user's browser language settings and activate the language. | |
If the default language is not supported, try secondary options. If none of the | |
user's languages are supported, then do nothing. | |
""" | |
def is_supported_language(self, language_code): | |
supported_languages = dict(settings.LANGUAGES).keys() | |
return language_code in supported_languages |