2016-05-18 34 views
0

http://docs.ckeditor.com/#!/api/CKEDITOR.configCKEditor的语言得到错误的“用户语言”

如上API医生说,如果lanaguage是空的,CKEditor的将显示的语言,默认语言了。但我的应用程序显示英文。

我的代码:

CKEDITOR_CONFIGS = { 
'default': { 
    'toolbar': 'Custom', 
    'toolbar_Custom': [ 
     [ 'Bold', 'Italic', 'Underline', 'Strike' ], 
     [ 'NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], 
     [ 'Table', 'HorizontalRule', 'Smiley'], 
     [ 'Format', 'Font', 'FontSize' ], 
     [ 'TextColor', 'BGColor' ], 
    ], 
    'width' : '100%', 
    'defaultLanguage' : 'ko', 
    'language' : '', 
} 

}

我该怎么办?

回答

2

Django-CKEDITOR实际上通过使用settings.py的语言设置来覆盖此标志。您需要确保所有以下设置已启用:

# Internationalization 
# https://docs.djangoproject.com/en/1.9/topics/i18n/ 

LANGUAGE_CODE = 'en' 

LANGUAGES = [ 
    ('ko', _('Korean')), 
    ('en', _('English')), 
] 

USE_I18N = True 

MIDDLEWARE_CLASSES = [ 
    ... 
    'django.middleware.locale.LocaleMiddleware', 
] 
+0

非常感谢!它有助于解决我的问题。对于其他遇到同样问题的人,此代码必须添加 'from django.utils.translation import ugettext_lazy as _' this。然后,它会完全工作! –