You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

translation.py 497B

12345678910111213141516171819
  1. from django.conf import settings
  2. from django.utils.translation.trans_real import language_code_re
  3. from . import Error, Tags, register
  4. E001 = Error(
  5. 'You have provided an invalid value for the LANGUAGE_CODE setting.',
  6. id='translation.E001',
  7. )
  8. @register(Tags.translation)
  9. def check_setting_language_code(app_configs, **kwargs):
  10. """
  11. Errors if language code setting is invalid.
  12. """
  13. if not language_code_re.match(settings.LANGUAGE_CODE):
  14. return [E001]
  15. return []