Skip to content

Fix creation of localised URLs for routable pages#546

Merged
MaciekBaron merged 12 commits intomainfrom
fix/cms-1103-language-switcher
Apr 17, 2026
Merged

Fix creation of localised URLs for routable pages#546
MaciekBaron merged 12 commits intomainfrom
fix/cms-1103-language-switcher

Conversation

@MaciekBaron
Copy link
Copy Markdown
Contributor

@MaciekBaron MaciekBaron commented Mar 24, 2026

What is the context of this PR?

This PR relates to a bug described in CMS-1103 which caused the language switcher to not preserve the correct path across domains for all page types.

This PR implements the proposed solution, which preserves the current request path by default and only swaps the language domain or prefix.

This also resolves CMS-765 and CMS-1165.

Specifically, the commit 59150db addresses CMS-1165.

How to review

  1. Ensure a page with routable paths exists (for instance an ArticleSeriesPage with /editions)
  2. Visit the page
  3. Ensure that the language switcher contains the correct URL
  4. Trigger a 404 page
  5. Ensure that the language switcher is still present

This should be tested for both subdomain and path based locales.

Deployment Safety

Bleed and Sandbox deploy automatically on merge, so PRs should be safe to deploy immediately.

Please select one:

  • Safe to auto-deploy
  • Not safe to auto-deploy

Follow-up Actions

  • Confirm that translated pages will not use a different slug
  • Consider how this works with versions (corrections)

@MaciekBaron MaciekBaron requested a review from a team as a code owner March 24, 2026 16:32
@MaciekBaron MaciekBaron added Bug Fix Something isn't working component: i18n 🌍 Internationalization / Localization labels Mar 25, 2026
Comment thread cms/core/templatetags/util_tags.py
Comment thread cms/core/templatetags/util_tags.py
Comment thread cms/core/tests/test_tags.py Outdated
Copy link
Copy Markdown
Contributor

@AdamHawtin AdamHawtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, working as expected with both path and subdomain based routing locally 👍

@sanjeevz3009 sanjeevz3009 self-requested a review April 14, 2026 11:08
Copy link
Copy Markdown
Contributor

@sanjeevz3009 sanjeevz3009 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a code review, looks good. Did a functional review locally, and this addresses the change needed from CMS-1103 and CMS-765.

@MaciekBaron
Copy link
Copy Markdown
Contributor Author

@MebinAbraham CMS-1165 has been addressed here: 59150db

Copy link
Copy Markdown
Contributor

@BJacksonONS BJacksonONS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, tested 404 pages also with subdomain and path routing.

Copy link
Copy Markdown
Contributor

@MebinAbraham MebinAbraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we'll do the corrections flow changes as a follow up.

@MaciekBaron MaciekBaron merged commit 0151156 into main Apr 17, 2026
18 checks passed
@MaciekBaron MaciekBaron deleted the fix/cms-1103-language-switcher branch April 17, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Something isn't working component: i18n 🌍 Internationalization / Localization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants