def multilingual(request): """ Returns context variables containing information about available languages. """ codes = sorted(get_language_code_list()) return {'LANGUAGE_CODES': codes, 'LANGUAGE_CODES_AND_NAMES': [(c, LANG_DICT.get(c, c)) for c in codes], 'DEFAULT_LANGUAGE_CODE': get_default_language_code(), 'ADMIN_MEDIA_URL': settings.ADMIN_MEDIA_PREFIX, 'CURRENT_LANGUAGE_CODE': get_language_code(), }
def multilingual(request): """ Returns context variables containing information about available languages. """ codes = sorted(get_language_code_list()) return { 'LANGUAGE_CODES': codes, 'LANGUAGE_CODES_AND_NAMES': [(c, LANG_DICT.get(c, c)) for c in codes], 'DEFAULT_LANGUAGE_CODE': get_default_language_code(), 'ADMIN_MEDIA_URL': settings.ADMIN_MEDIA_PREFIX, 'CURRENT_LANGUAGE_CODE': get_language_code(), }
def language_bar(context): from django.conf import settings from multilingual import get_default_language from multilingual.languages import get_language_code languages = settings.LANGUAGES current_language = get_language_code() if 'request' in context: path_info = context['request'].path_info if context['request'].META['QUERY_STRING'] != '': path_info += '?' + context['request'].META['QUERY_STRING'] else: path_info = '' return locals()
def language_code(language_id): """ Return the code of the language with id=language_id """ return get_language_code(language_id)