regluit/utils/lang.py

7 lines
211 B
Python
Raw Normal View History

from django.conf.global_settings import LANGUAGES
lang2code = dict([ (lang[1].lower(), lang[0]) for lang in LANGUAGES ])
def get_language_code(language):
return lang2code.get(language.lower().strip(), '')