Skip to content

Commit

Permalink
Support long locale in dynamic served js catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Jan 22, 2025
1 parent 05fdf33 commit 13adf48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/olympia/addons/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7968,3 +7968,11 @@ def test_get_correct_catalog(self):
'"Une erreur est survenue pendant l\\u2019envoi de votre fichier."'
in content
)

@pytest.mark.needs_locales_compilation
def test_long_locales(self):
for locale in ['en-US', 'sr-Latn', 'cak']:
url = reverse('javascript-catalog', kwargs={'locale': locale})
content = self.client.get(url).content.decode('utf-8')
assert 'There was an error uploading your file.' in content

2 changes: 1 addition & 1 deletion src/olympia/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def serve_javascript_catalog(request, locale, **kwargs):
),
# Serve javascript catalog locales bundle directly from django
re_path(
r'^static/js/i18n/(?P<locale>\w+)\.js$',
r'^static/js/i18n/(?P<locale>\w{2,3}(?:-\w{2,6})?)\.js$',
serve_javascript_catalog,
name='javascript-catalog',
),
Expand Down

0 comments on commit 13adf48

Please sign in to comment.