prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Redirected to a non-existing page while tring to translate to en-US
  ## Description
  
  When I try to translate an application to `en-US`, I am redirected (`301`) to a non-existing page:
  
  ![image](https://user-images.githubusercontent.com/971438/144014809-d5545965-1c2f-4c55-86f6-dd2160627e02.png)
  
  → `/en-US/my-project/` is redirected to `/my-project/`
  
  ## Steps to reproduce
  
  * Add the `en-US` locale to a project
  * Browse project's language
  * Click on English (en-US)
  * → 404
  
  ## More...
  
  This seems to be caused by some legacy code in `pontoon/urls.py:26`:
  
  ```python
  urlpatterns = [
      # Legacy: Locale redirect for compatibility with i18n ready URL scheme
      path("en-US<path:url>", RedirectView.as_view(url="%(url)s", permanent=True)),
  ```
  
  Removing this line fixes the problem and does not seem to cause additional issues (I am still testing on a production instance).
  
  * This issue may be related to → #2192 
  * Another issue to look at about `en-US` locale → #2260
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pontoon/urls.py`
  Content:
  ```
  1 from django.urls import include, path, register_converter
  2 from django.urls.converters import StringConverter
  3 from django.contrib import admin
  4 from django.contrib.auth import logout
  5 from django.views.generic import RedirectView, TemplateView
  6 
  7 from pontoon.teams.views import team
  8 
  9 
  10 class LocaleConverter(StringConverter):
  11     regex = r"[A-Za-z0-9\-\@\.]+"
  12 
  13 
  14 register_converter(LocaleConverter, "locale")
  15 
  16 pontoon_js_view = TemplateView.as_view(
  17     template_name="js/pontoon.js", content_type="text/javascript"
  18 )
  19 
  20 permission_denied_view = TemplateView.as_view(template_name="403.html")
  21 page_not_found_view = TemplateView.as_view(template_name="404.html")
  22 server_error_view = TemplateView.as_view(template_name="500.html")
  23 
  24 urlpatterns = [
  25     # Legacy: Locale redirect for compatibility with i18n ready URL scheme
  26     path("en-US<path:url>", RedirectView.as_view(url="%(url)s", permanent=True)),
  27     # Redirect legacy Aurora projects
  28     path(
  29         "projects/firefox-aurora/<path:url>",
  30         RedirectView.as_view(url="/projects/firefox/%(url)s", permanent=True),
  31     ),
  32     path(
  33         "projects/firefox-for-android-aurora/<path:url>",
  34         RedirectView.as_view(
  35             url="/projects/firefox-for-android/%(url)s", permanent=True
  36         ),
  37     ),
  38     path(
  39         "projects/thunderbird-aurora/<path:url>",
  40         RedirectView.as_view(url="/projects/thunderbird/%(url)s", permanent=True),
  41     ),
  42     path(
  43         "projects/lightning-aurora/<path:url>",
  44         RedirectView.as_view(url="/projects/lightning/%(url)s", permanent=True),
  45     ),
  46     path(
  47         "projects/seamonkey-aurora/<path:url>",
  48         RedirectView.as_view(url="/projects/seamonkey/%(url)s", permanent=True),
  49     ),
  50     path(
  51         "<locale:locale>/firefox-aurora/<path:url>",
  52         RedirectView.as_view(url="/%(locale)s/firefox/%(url)s", permanent=True),
  53     ),
  54     path(
  55         "<locale:locale>/firefox-for-android-aurora/<path:url>",
  56         RedirectView.as_view(
  57             url="/%(locale)s/firefox-for-android/%(url)s", permanent=True
  58         ),
  59     ),
  60     path(
  61         "<locale:locale>/thunderbird-aurora/<path:url>",
  62         RedirectView.as_view(url="/%(locale)s/thunderbird/%(url)s", permanent=True),
  63     ),
  64     path(
  65         "<locale:locale>/lightning-aurora/<path:url>",
  66         RedirectView.as_view(url="/%(locale)s/lightning/%(url)s", permanent=True),
  67     ),
  68     path(
  69         "<locale:locale>/seamonkey-aurora/<path:url>",
  70         RedirectView.as_view(url="/%(locale)s/seamonkey/%(url)s", permanent=True),
  71     ),
  72     # Accounts
  73     path("accounts/", include("pontoon.allauth_urls")),
  74     # Admin
  75     path("admin/", include("pontoon.administration.urls")),
  76     # Django admin: Disable the login form
  77     path("a/login/", permission_denied_view),
  78     # Django admin
  79     path("a/", admin.site.urls),
  80     # Logout
  81     path("signout/", logout, {"next_page": "/"}, name="signout"),
  82     # Error pages
  83     path("403/", permission_denied_view),
  84     path("404/", page_not_found_view),
  85     path("500/", server_error_view),
  86     # Robots.txt
  87     path(
  88         "robots.txt",
  89         TemplateView.as_view(template_name="robots.txt", content_type="text/plain"),
  90     ),
  91     # contribute.json
  92     path(
  93         "contribute.json",
  94         TemplateView.as_view(
  95             template_name="contribute.json", content_type="text/plain"
  96         ),
  97     ),
  98     # Favicon
  99     path(
  100         "favicon.ico",
  101         RedirectView.as_view(url="/static/img/favicon.ico", permanent=True),
  102     ),
  103     # Include script
  104     path("pontoon.js", pontoon_js_view),
  105     path("static/js/pontoon.js", pontoon_js_view),
  106     # Include URL configurations from installed apps
  107     path("terminology/", include("pontoon.terminology.urls")),
  108     path("translations/", include("pontoon.translations.urls")),
  109     path("", include("pontoon.teams.urls")),
  110     path("", include("pontoon.tour.urls")),
  111     path("", include("pontoon.tags.urls")),
  112     path("", include("pontoon.sync.urls")),
  113     path("", include("pontoon.projects.urls")),
  114     path("", include("pontoon.machinery.urls")),
  115     path("", include("pontoon.contributors.urls")),
  116     path("", include("pontoon.localizations.urls")),
  117     path("", include("pontoon.base.urls")),
  118     path("", include("pontoon.translate.urls")),
  119     path("", include("pontoon.batch.urls")),
  120     path("", include("pontoon.api.urls")),
  121     path("", include("pontoon.homepage.urls")),
  122     path("", include("pontoon.in_context.urls")),
  123     path("", include("pontoon.uxactionlog.urls")),
  124     # Team page: Must be at the end
  125     path("<locale:locale>/", team, name="pontoon.teams.team"),
  126 ]
  127
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pontoon/urls.py b/pontoon/urls.py
  --- a/pontoon/urls.py
  +++ b/pontoon/urls.py
  @@ -22,8 +22,6 @@
   server_error_view = TemplateView.as_view(template_name="500.html")
   
   urlpatterns = [
  -    # Legacy: Locale redirect for compatibility with i18n ready URL scheme
  -    path("en-US<path:url>", RedirectView.as_view(url="%(url)s", permanent=True)),
       # Redirect legacy Aurora projects
       path(
           "projects/firefox-aurora/<path:url>",
  
verification_info: {"golden_diff": "diff --git a/pontoon/urls.py b/pontoon/urls.py\n--- a/pontoon/urls.py\n+++ b/pontoon/urls.py\n@@ -22,8 +22,6 @@\n server_error_view = TemplateView.as_view(template_name=\"500.html\")\n \n urlpatterns = [\n-    # Legacy: Locale redirect for compatibility with i18n ready URL scheme\n-    path(\"en-US<path:url>\", RedirectView.as_view(url=\"%(url)s\", permanent=True)),\n     # Redirect legacy Aurora projects\n     path(\n         \"projects/firefox-aurora/<path:url>\",\n", "issue": "Redirected to a non-existing page while tring to translate to en-US\n## Description\r\n\r\nWhen I try to translate an application to `en-US`, I am redirected (`301`) to a non-existing page:\r\n\r\n![image](https://user-images.githubusercontent.com/971438/144014809-d5545965-1c2f-4c55-86f6-dd2160627e02.png)\r\n\r\n\u2192 `/en-US/my-project/` is redirected to `/my-project/`\r\n\r\n## Steps to reproduce\r\n\r\n* Add the `en-US` locale to a project\r\n* Browse project's language\r\n* Click on English (en-US)\r\n* \u2192 404\r\n\r\n## More...\r\n\r\nThis seems to be caused by some legacy code in `pontoon/urls.py:26`:\r\n\r\n```python\r\nurlpatterns = [\r\n    # Legacy: Locale redirect for compatibility with i18n ready URL scheme\r\n    path(\"en-US<path:url>\", RedirectView.as_view(url=\"%(url)s\", permanent=True)),\r\n```\r\n\r\nRemoving this line fixes the problem and does not seem to cause additional issues (I am still testing on a production instance).\r\n\r\n* This issue may be related to \u2192 #2192 \r\n* Another issue to look at about `en-US` locale \u2192 #2260\r\n\n", "before_files": [{"content": "from django.urls import include, path, register_converter\nfrom django.urls.converters import StringConverter\nfrom django.contrib import admin\nfrom django.contrib.auth import logout\nfrom django.views.generic import RedirectView, TemplateView\n\nfrom pontoon.teams.views import team\n\n\nclass LocaleConverter(StringConverter):\n    regex = r\"[A-Za-z0-9\\-\\@\\.]+\"\n\n\nregister_converter(LocaleConverter, \"locale\")\n\npontoon_js_view = TemplateView.as_view(\n    template_name=\"js/pontoon.js\", content_type=\"text/javascript\"\n)\n\npermission_denied_view = TemplateView.as_view(template_name=\"403.html\")\npage_not_found_view = TemplateView.as_view(template_name=\"404.html\")\nserver_error_view = TemplateView.as_view(template_name=\"500.html\")\n\nurlpatterns = [\n    # Legacy: Locale redirect for compatibility with i18n ready URL scheme\n    path(\"en-US<path:url>\", RedirectView.as_view(url=\"%(url)s\", permanent=True)),\n    # Redirect legacy Aurora projects\n    path(\n        \"projects/firefox-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/firefox/%(url)s\", permanent=True),\n    ),\n    path(\n        \"projects/firefox-for-android-aurora/<path:url>\",\n        RedirectView.as_view(\n            url=\"/projects/firefox-for-android/%(url)s\", permanent=True\n        ),\n    ),\n    path(\n        \"projects/thunderbird-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/thunderbird/%(url)s\", permanent=True),\n    ),\n    path(\n        \"projects/lightning-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/lightning/%(url)s\", permanent=True),\n    ),\n    path(\n        \"projects/seamonkey-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/seamonkey/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/firefox-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/firefox/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/firefox-for-android-aurora/<path:url>\",\n        RedirectView.as_view(\n            url=\"/%(locale)s/firefox-for-android/%(url)s\", permanent=True\n        ),\n    ),\n    path(\n        \"<locale:locale>/thunderbird-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/thunderbird/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/lightning-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/lightning/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/seamonkey-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/seamonkey/%(url)s\", permanent=True),\n    ),\n    # Accounts\n    path(\"accounts/\", include(\"pontoon.allauth_urls\")),\n    # Admin\n    path(\"admin/\", include(\"pontoon.administration.urls\")),\n    # Django admin: Disable the login form\n    path(\"a/login/\", permission_denied_view),\n    # Django admin\n    path(\"a/\", admin.site.urls),\n    # Logout\n    path(\"signout/\", logout, {\"next_page\": \"/\"}, name=\"signout\"),\n    # Error pages\n    path(\"403/\", permission_denied_view),\n    path(\"404/\", page_not_found_view),\n    path(\"500/\", server_error_view),\n    # Robots.txt\n    path(\n        \"robots.txt\",\n        TemplateView.as_view(template_name=\"robots.txt\", content_type=\"text/plain\"),\n    ),\n    # contribute.json\n    path(\n        \"contribute.json\",\n        TemplateView.as_view(\n            template_name=\"contribute.json\", content_type=\"text/plain\"\n        ),\n    ),\n    # Favicon\n    path(\n        \"favicon.ico\",\n        RedirectView.as_view(url=\"/static/img/favicon.ico\", permanent=True),\n    ),\n    # Include script\n    path(\"pontoon.js\", pontoon_js_view),\n    path(\"static/js/pontoon.js\", pontoon_js_view),\n    # Include URL configurations from installed apps\n    path(\"terminology/\", include(\"pontoon.terminology.urls\")),\n    path(\"translations/\", include(\"pontoon.translations.urls\")),\n    path(\"\", include(\"pontoon.teams.urls\")),\n    path(\"\", include(\"pontoon.tour.urls\")),\n    path(\"\", include(\"pontoon.tags.urls\")),\n    path(\"\", include(\"pontoon.sync.urls\")),\n    path(\"\", include(\"pontoon.projects.urls\")),\n    path(\"\", include(\"pontoon.machinery.urls\")),\n    path(\"\", include(\"pontoon.contributors.urls\")),\n    path(\"\", include(\"pontoon.localizations.urls\")),\n    path(\"\", include(\"pontoon.base.urls\")),\n    path(\"\", include(\"pontoon.translate.urls\")),\n    path(\"\", include(\"pontoon.batch.urls\")),\n    path(\"\", include(\"pontoon.api.urls\")),\n    path(\"\", include(\"pontoon.homepage.urls\")),\n    path(\"\", include(\"pontoon.in_context.urls\")),\n    path(\"\", include(\"pontoon.uxactionlog.urls\")),\n    # Team page: Must be at the end\n    path(\"<locale:locale>/\", team, name=\"pontoon.teams.team\"),\n]\n", "path": "pontoon/urls.py"}], "after_files": [{"content": "from django.urls import include, path, register_converter\nfrom django.urls.converters import StringConverter\nfrom django.contrib import admin\nfrom django.contrib.auth import logout\nfrom django.views.generic import RedirectView, TemplateView\n\nfrom pontoon.teams.views import team\n\n\nclass LocaleConverter(StringConverter):\n    regex = r\"[A-Za-z0-9\\-\\@\\.]+\"\n\n\nregister_converter(LocaleConverter, \"locale\")\n\npontoon_js_view = TemplateView.as_view(\n    template_name=\"js/pontoon.js\", content_type=\"text/javascript\"\n)\n\npermission_denied_view = TemplateView.as_view(template_name=\"403.html\")\npage_not_found_view = TemplateView.as_view(template_name=\"404.html\")\nserver_error_view = TemplateView.as_view(template_name=\"500.html\")\n\nurlpatterns = [\n    # Redirect legacy Aurora projects\n    path(\n        \"projects/firefox-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/firefox/%(url)s\", permanent=True),\n    ),\n    path(\n        \"projects/firefox-for-android-aurora/<path:url>\",\n        RedirectView.as_view(\n            url=\"/projects/firefox-for-android/%(url)s\", permanent=True\n        ),\n    ),\n    path(\n        \"projects/thunderbird-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/thunderbird/%(url)s\", permanent=True),\n    ),\n    path(\n        \"projects/lightning-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/lightning/%(url)s\", permanent=True),\n    ),\n    path(\n        \"projects/seamonkey-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/projects/seamonkey/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/firefox-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/firefox/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/firefox-for-android-aurora/<path:url>\",\n        RedirectView.as_view(\n            url=\"/%(locale)s/firefox-for-android/%(url)s\", permanent=True\n        ),\n    ),\n    path(\n        \"<locale:locale>/thunderbird-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/thunderbird/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/lightning-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/lightning/%(url)s\", permanent=True),\n    ),\n    path(\n        \"<locale:locale>/seamonkey-aurora/<path:url>\",\n        RedirectView.as_view(url=\"/%(locale)s/seamonkey/%(url)s\", permanent=True),\n    ),\n    # Accounts\n    path(\"accounts/\", include(\"pontoon.allauth_urls\")),\n    # Admin\n    path(\"admin/\", include(\"pontoon.administration.urls\")),\n    # Django admin: Disable the login form\n    path(\"a/login/\", permission_denied_view),\n    # Django admin\n    path(\"a/\", admin.site.urls),\n    # Logout\n    path(\"signout/\", logout, {\"next_page\": \"/\"}, name=\"signout\"),\n    # Error pages\n    path(\"403/\", permission_denied_view),\n    path(\"404/\", page_not_found_view),\n    path(\"500/\", server_error_view),\n    # Robots.txt\n    path(\n        \"robots.txt\",\n        TemplateView.as_view(template_name=\"robots.txt\", content_type=\"text/plain\"),\n    ),\n    # contribute.json\n    path(\n        \"contribute.json\",\n        TemplateView.as_view(\n            template_name=\"contribute.json\", content_type=\"text/plain\"\n        ),\n    ),\n    # Favicon\n    path(\n        \"favicon.ico\",\n        RedirectView.as_view(url=\"/static/img/favicon.ico\", permanent=True),\n    ),\n    # Include script\n    path(\"pontoon.js\", pontoon_js_view),\n    path(\"static/js/pontoon.js\", pontoon_js_view),\n    # Include URL configurations from installed apps\n    path(\"terminology/\", include(\"pontoon.terminology.urls\")),\n    path(\"translations/\", include(\"pontoon.translations.urls\")),\n    path(\"\", include(\"pontoon.teams.urls\")),\n    path(\"\", include(\"pontoon.tour.urls\")),\n    path(\"\", include(\"pontoon.tags.urls\")),\n    path(\"\", include(\"pontoon.sync.urls\")),\n    path(\"\", include(\"pontoon.projects.urls\")),\n    path(\"\", include(\"pontoon.machinery.urls\")),\n    path(\"\", include(\"pontoon.contributors.urls\")),\n    path(\"\", include(\"pontoon.localizations.urls\")),\n    path(\"\", include(\"pontoon.base.urls\")),\n    path(\"\", include(\"pontoon.translate.urls\")),\n    path(\"\", include(\"pontoon.batch.urls\")),\n    path(\"\", include(\"pontoon.api.urls\")),\n    path(\"\", include(\"pontoon.homepage.urls\")),\n    path(\"\", include(\"pontoon.in_context.urls\")),\n    path(\"\", include(\"pontoon.uxactionlog.urls\")),\n    # Team page: Must be at the end\n    path(\"<locale:locale>/\", team, name=\"pontoon.teams.team\"),\n]\n", "path": "pontoon/urls.py"}]}