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(),
            }
예제 #2
0
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(),
    }
예제 #3
0
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()
예제 #4
0
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)
def language_code(language_id):
    """
    Return the code of the language with id=language_id
    """
    return get_language_code(language_id)