(content_language=None)
return config
Get language config.
Get language config.
Get language config .
def get_language_config(content_language=None):
    """Get language config."""

    language = get_language()[:2]

    if content_language:
        content_language = content_language[:2]
    else:
        content_language = language

    config = {
        'language': language,
    }

    lang_names = OrderedDict()
    for lang, name in settings.LANGUAGES:
        if lang[:2] not in lang_names:
            lang_names[lang[:2]] = []

        lang_names[lang[:2]].append(_(name))

    sp_langs = []

    for lang, names in lang_names.items():
        if lang == content_language:
            default = '+'
        else:
            default = ''
        sp_langs.append('%s%s=%s' % (default, ' / '.join(names), lang))

    config['spellchecker_languages'] = ','.join(sp_langs)

    if content_language in settings.LANGUAGES_BIDI:
        config['directionality'] = 'rtl'
    else:
        config['directionality'] = 'ltr'

    if tinymce_settings.USE_SPELLCHECKER:
        config['spellchecker_rpc_url'] = reverse('tinymce.views.spell_check')

    return config
def get_language_config ( content_language = None ) : language = get_language ( ) [ : 2 ] if content_language : content_language = content_language [ : 2 ] else : content_language = language config = { 'language' : language , } lang_names = OrderedDict ( ) for lang , name in settings . LANGUAGES : if lang [ : 2 ] not in lang_names : lang_names [ lang [ : 2 ] ] = [ ] lang_names [ lang [ : 2 ] ] . append ( _ ( name ) ) sp_langs = [ ] for lang , names in lang_names . items ( ) : if lang == content_language : default = '+' else : default = '' sp_langs . append ( '%s%s=%s' % ( default , ' / ' . join ( names ) , lang ) ) config [ 'spellchecker_languages' ] = ',' . join ( sp_langs ) if content_language in settings . LANGUAGES_BIDI : config [ 'directionality' ] = 'rtl' else : config [ 'directionality' ] = 'ltr' if tinymce_settings . USE_SPELLCHECKER : config [ 'spellchecker_rpc_url' ] = reverse ( 'tinymce.views.spell_check' ) return config