diff --git a/django/core/checks/translation.py b/django/core/checks/translation.py index ebbd1eabf3..138ed07ff8 100644 --- a/django/core/checks/translation.py +++ b/django/core/checks/translation.py @@ -4,17 +4,17 @@ 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: {}.', + 'You have provided an invalid value for the LANGUAGE_CODE setting: {!r}.', id='translation.E001', ) E002 = Error( - 'You have provided an invalid language code in the LANGUAGES setting: {}.', + 'You have provided an invalid language code in the LANGUAGES setting: {!r}.', id='translation.E002', ) E003 = Error( - 'You have provided an invalid language code in the LANGUAGES_BIDI setting: {}.', + 'You have provided an invalid language code in the LANGUAGES_BIDI setting: {!r}.', id='translation.E003', ) diff --git a/tests/check_framework/test_translation.py b/tests/check_framework/test_translation.py index cb6e053d77..4cd79d803f 100644 --- a/tests/check_framework/test_translation.py +++ b/tests/check_framework/test_translation.py @@ -42,7 +42,7 @@ class TranslationCheckTests(SimpleTestCase): self.assertEqual(check_setting_language_code(None), []) def test_invalid_language_code(self): - msg = 'You have provided an invalid value for the LANGUAGE_CODE setting: %s.' + msg = 'You have provided an invalid value for the LANGUAGE_CODE setting: %r.' for tag in self.invalid_tags: with self.subTest(tag), self.settings(LANGUAGE_CODE=tag): self.assertEqual(check_setting_language_code(None), [ @@ -55,7 +55,7 @@ class TranslationCheckTests(SimpleTestCase): self.assertEqual(check_setting_languages(None), []) def test_invalid_languages(self): - msg = 'You have provided an invalid language code in the LANGUAGES setting: %s.' + msg = 'You have provided an invalid language code in the LANGUAGES setting: %r.' for tag in self.invalid_tags: with self.subTest(tag), self.settings(LANGUAGES=[(tag, tag)]): self.assertEqual(check_setting_languages(None), [ @@ -68,7 +68,7 @@ class TranslationCheckTests(SimpleTestCase): self.assertEqual(check_setting_languages_bidi(None), []) def test_invalid_languages_bidi(self): - msg = 'You have provided an invalid language code in the LANGUAGES_BIDI setting: %s.' + msg = 'You have provided an invalid language code in the LANGUAGES_BIDI setting: %r.' for tag in self.invalid_tags: with self.subTest(tag), self.settings(LANGUAGES_BIDI=[tag]): self.assertEqual(check_setting_languages_bidi(None), [