summaryrefslogtreecommitdiff
path: root/django/core/checks/translation.py
blob: cf69a5c084a8be8c5f5ccc15a5773f2ddec89109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from django.conf import settings
from django.utils.translation.trans_real import language_code_re

from . import Error, Tags, register

E001 = Error(
    'You have provided an invalid value for the LANGUAGE_CODE setting.',
    id='translation.E001',
)


@register(Tags.translation)
def check_setting_language_code(app_configs, **kwargs):
    """
    Errors if language code setting is invalid.
    """
    if not language_code_re.match(settings.LANGUAGE_CODE):
        return [E001]
    return []