|
10 | 10 | from django.conf import settings
|
11 | 11 | from django.utils.decorators import method_decorator
|
12 | 12 | from django.utils.termcolors import colorize
|
| 13 | +from django.utils.translation.trans_real import accept_language_re |
13 | 14 | from sekizai.helpers import validate_template
|
14 | 15 |
|
15 | 16 | SUCCESS = 1
|
@@ -187,6 +188,16 @@ def check_i18n(output):
|
187 | 188 | section.success("New style CMS_LANGUAGES")
|
188 | 189 | else:
|
189 | 190 | section.warn("Old style (tuple based) CMS_LANGUAGES, please switch to the new (dictionary based) style")
|
| 191 | + if getattr(settings, 'LANGUAGE_CODE', '').find('_') > -1: |
| 192 | + section.warn("LANGUAGE_CODE must contain a valid language code, not a locale ('%s' provided)" % getattr(settings, 'LANGUAGE_CODE', '')) |
| 193 | + for lang in getattr(settings, 'LANGUAGES', ()): |
| 194 | + if lang[0].find('_') > -1: |
| 195 | + section.warn("LANGUAGES must contain valid language codes, not locales ('%s' provided)" % lang[0]) |
| 196 | + for site, items in get_cms_setting('LANGUAGES').items(): |
| 197 | + if type(site) == int: |
| 198 | + for lang in items: |
| 199 | + if lang['code'].find('_') > -1: |
| 200 | + section.warn("CMS_LANGUAGES entries must contain valid language codes, not locales ('%s' provided)" % lang['code']) |
190 | 201 | for deprecated in ['CMS_HIDE_UNTRANSLATED', 'CMS_LANGUAGE_FALLBACK', 'CMS_LANGUAGE_CONF', 'CMS_SITE_LANGUAGES', 'CMS_FRONTEND_LANGUAGES']:
|
191 | 202 | if hasattr(settings, deprecated):
|
192 | 203 | section.warn("Deprecated setting %s found. This setting is now handled in the new style CMS_LANGUAGES and can be removed" % deprecated)
|
|
0 commit comments