mirror of
https://github.com/django/django.git
synced 2024-12-22 00:55:44 +00:00
Fixed #35973 -- Improved makemessages locale validation to handle numeric region codes.
This commit is contained in:
parent
d345e5b5f8
commit
08feaae588
@ -40,7 +40,7 @@ def check_programs(*programs):
|
||||
|
||||
|
||||
def is_valid_locale(locale):
|
||||
return re.match(r"^[a-z]+$", locale) or re.match(r"^[a-z]+_[A-Z].*$", locale)
|
||||
return re.match(r"^[a-z]+$", locale) or re.match(r"^[a-z]+_[A-Z0-9].*$", locale)
|
||||
|
||||
|
||||
@total_ordering
|
||||
|
@ -179,6 +179,15 @@ class BasicExtractorTests(ExtractorTests):
|
||||
self.assertIn("processing locale en_GB", out.getvalue())
|
||||
self.assertIs(Path("locale/en_GB/LC_MESSAGES/django.po").exists(), True)
|
||||
|
||||
def test_valid_locale_with_numeric_region_code(self):
|
||||
out = StringIO()
|
||||
management.call_command(
|
||||
"makemessages", locale=["ar_002"], stdout=out, verbosity=1
|
||||
)
|
||||
self.assertNotIn("invalid locale ar_002", out.getvalue())
|
||||
self.assertIn("processing locale ar_002", out.getvalue())
|
||||
self.assertIs(Path("locale/ar_002/LC_MESSAGES/django.po").exists(), True)
|
||||
|
||||
def test_valid_locale_tachelhit_latin_morocco(self):
|
||||
out = StringIO()
|
||||
management.call_command(
|
||||
|
Loading…
Reference in New Issue
Block a user