diff --git a/tests/i18n/patterns/locale/en/LC_MESSAGES/django.mo b/tests/i18n/patterns/locale/en/LC_MESSAGES/django.mo index bca387b04c..b1f63b1031 100644 Binary files a/tests/i18n/patterns/locale/en/LC_MESSAGES/django.mo and b/tests/i18n/patterns/locale/en/LC_MESSAGES/django.mo differ diff --git a/tests/i18n/patterns/locale/en/LC_MESSAGES/django.po b/tests/i18n/patterns/locale/en/LC_MESSAGES/django.po index 4e609f038e..ac98eb5f08 100644 --- a/tests/i18n/patterns/locale/en/LC_MESSAGES/django.po +++ b/tests/i18n/patterns/locale/en/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-28 11:48+0000\n" +"POT-Creation-Date: 2024-03-01 21:18+0000\n" "PO-Revision-Date: 2011-06-14 16:16+0100\n" "Last-Translator: Jannis Leidel \n" "Language-Team: LANGUAGE \n" @@ -17,22 +17,30 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: urls/default.py:11 -msgid "^translated/$" +#, fuzzy +#| msgid "^translated/$" +msgid "translated/" msgstr "^translated/$" -#: urls/default.py:13 +#: urls/default.py:12 +#, fuzzy +#| msgid "^translated/$" +msgid "^translated-regex/$" +msgstr "^translated/$" + +#: urls/default.py:14 msgid "^translated/(?P[\\w-]+)/$" msgstr "^translated/(?P[\\w-]+)/$" -#: urls/default.py:24 +#: urls/default.py:25 msgid "^with-arguments/(?P[\\w-]+)/(?:(?P[\\w-]+).html)?$" msgstr "" -#: urls/default.py:28 +#: urls/default.py:29 msgid "^users/$" msgstr "^users/$" -#: urls/default.py:30 urls/wrong.py:7 +#: urls/default.py:31 urls/wrong.py:7 msgid "^account/" msgstr "^account/" diff --git a/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.mo b/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.mo index 730462386e..544bfdbfc6 100644 Binary files a/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.mo and b/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.mo differ diff --git a/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.po b/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.po index f78a11502f..aa58c506d5 100644 --- a/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.po +++ b/tests/i18n/patterns/locale/nl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-28 11:48+0000\n" +"POT-Creation-Date: 2024-03-01 21:18+0000\n" "PO-Revision-Date: 2011-06-14 16:16+0100\n" "Last-Translator: Jannis Leidel \n" "Language-Team: LANGUAGE \n" @@ -18,22 +18,26 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1)\n" #: urls/default.py:11 -msgid "^translated/$" -msgstr "^vertaald/$" +msgid "translated/" +msgstr "vertaald/" -#: urls/default.py:13 +#: urls/default.py:12 +msgid "^translated-regex/$" +msgstr "^vertaald-regex/$" + +#: urls/default.py:14 msgid "^translated/(?P[\\w-]+)/$" msgstr "^vertaald/(?P[\\w-]+)/$" -#: urls/default.py:24 +#: urls/default.py:25 msgid "^with-arguments/(?P[\\w-]+)/(?:(?P[\\w-]+).html)?$" msgstr "" -#: urls/default.py:28 +#: urls/default.py:29 msgid "^users/$" msgstr "^gebruikers/$" -#: urls/default.py:30 urls/wrong.py:7 +#: urls/default.py:31 urls/wrong.py:7 msgid "^account/" msgstr "^profiel/" diff --git a/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.mo b/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.mo index 431a4016df..8e36cb2064 100644 Binary files a/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.mo and b/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.mo differ diff --git a/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.po b/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.po index 6874b2d028..464d14bc1f 100644 --- a/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.po +++ b/tests/i18n/patterns/locale/pt_BR/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-28 11:48+0000\n" +"POT-Creation-Date: 2024-03-01 21:18+0000\n" "PO-Revision-Date: 2011-06-14 16:17+0100\n" "Last-Translator: Jannis Leidel \n" "Language-Team: LANGUAGE \n" @@ -18,22 +18,26 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1)\n" #: urls/default.py:11 -msgid "^translated/$" -msgstr "^traduzidos/$" +msgid "translated/" +msgstr "traduzidos/" -#: urls/default.py:13 +#: urls/default.py:12 +msgid "^translated-regex/$" +msgstr "^traduzidos-regex/$" + +#: urls/default.py:14 msgid "^translated/(?P[\\w-]+)/$" msgstr "^traduzidos/(?P[\\w-]+)/$" -#: urls/default.py:24 +#: urls/default.py:25 msgid "^with-arguments/(?P[\\w-]+)/(?:(?P[\\w-]+).html)?$" msgstr "" -#: urls/default.py:28 +#: urls/default.py:29 msgid "^users/$" msgstr "^usuarios/$" -#: urls/default.py:30 urls/wrong.py:7 +#: urls/default.py:31 urls/wrong.py:7 msgid "^account/" msgstr "^conta/" diff --git a/tests/i18n/patterns/tests.py b/tests/i18n/patterns/tests.py index e2fee904b1..bd329e69f8 100644 --- a/tests/i18n/patterns/tests.py +++ b/tests/i18n/patterns/tests.py @@ -134,6 +134,9 @@ class URLTranslationTests(URLTestCaseBase): def test_no_prefix_translated(self): with translation.override("en"): self.assertEqual(reverse("no-prefix-translated"), "/translated/") + self.assertEqual( + reverse("no-prefix-translated-regex"), "/translated-regex/" + ) self.assertEqual( reverse("no-prefix-translated-slug", kwargs={"slug": "yeah"}), "/translated/yeah/", @@ -141,6 +144,7 @@ class URLTranslationTests(URLTestCaseBase): with translation.override("nl"): self.assertEqual(reverse("no-prefix-translated"), "/vertaald/") + self.assertEqual(reverse("no-prefix-translated-regex"), "/vertaald-regex/") self.assertEqual( reverse("no-prefix-translated-slug", kwargs={"slug": "yeah"}), "/vertaald/yeah/", @@ -148,6 +152,9 @@ class URLTranslationTests(URLTestCaseBase): with translation.override("pt-br"): self.assertEqual(reverse("no-prefix-translated"), "/traduzidos/") + self.assertEqual( + reverse("no-prefix-translated-regex"), "/traduzidos-regex/" + ) self.assertEqual( reverse("no-prefix-translated-slug", kwargs={"slug": "yeah"}), "/traduzidos/yeah/", @@ -180,7 +187,7 @@ class URLTranslationTests(URLTestCaseBase): "/nl/profiel/registreren-als-pad/", ) self.assertEqual(translation.get_language(), "en") - # URL with parameters. + # re_path() URL with parameters. self.assertEqual( translate_url("/en/with-arguments/regular-argument/", "nl"), "/nl/with-arguments/regular-argument/", @@ -191,6 +198,11 @@ class URLTranslationTests(URLTestCaseBase): ), "/nl/with-arguments/regular-argument/optional.html", ) + # path() URL with parameter. + self.assertEqual( + translate_url("/en/path-with-arguments/regular-argument/", "nl"), + "/nl/path-with-arguments/regular-argument/", + ) with translation.override("nl"): self.assertEqual(translate_url("/nl/gebruikers/", "en"), "/en/users/") diff --git a/tests/i18n/patterns/urls/default.py b/tests/i18n/patterns/urls/default.py index 418e9f5685..090b92eeca 100644 --- a/tests/i18n/patterns/urls/default.py +++ b/tests/i18n/patterns/urls/default.py @@ -8,7 +8,8 @@ view = TemplateView.as_view(template_name="dummy.html") urlpatterns = [ path("not-prefixed/", view, name="not-prefixed"), path("not-prefixed-include/", include("i18n.patterns.urls.included")), - re_path(_(r"^translated/$"), view, name="no-prefix-translated"), + path(_("translated/"), view, name="no-prefix-translated"), + re_path(_(r"^translated-regex/$"), view, name="no-prefix-translated-regex"), re_path( _(r"^translated/(?P[\w-]+)/$"), view, @@ -25,6 +26,11 @@ urlpatterns += i18n_patterns( view, name="with-arguments", ), + path( + _("path-with-arguments//"), + view, + name="path-with-arguments", + ), re_path(_(r"^users/$"), view, name="users"), re_path( _(r"^account/"), include("i18n.patterns.urls.namespace", namespace="account")