Skip to content

fix: translate CMS item slugs on locale switch and links#341

Merged
tristan-mouchet merged 1 commit into
developfrom
fix/locale-selector-translated-slugs
Jun 10, 2026
Merged

fix: translate CMS item slugs on locale switch and links#341
tristan-mouchet merged 1 commit into
developfrom
fix/locale-selector-translated-slugs

Conversation

@tristan-mouchet

Copy link
Copy Markdown
Collaborator

Summary

Switching language on a dynamic CMS page now preserves the translated item slug instead of keeping the source-language one, and dynamic-page links resolve to the localized URL. Closes #340.

Changes

  • Add buildLocalizedPageUrls utility that resolves translated folder/page/CMS slugs into relative URLs per locale
  • Pre-compute these URLs server-side in PageRenderer (only on multi-locale pages with a locale selector) and pass them to LocaleSelector, which now prefers them over naive prefix manipulation
  • Use the raw source slug as the default-locale value and per-locale fallback (the current-locale collectionItem values are already translated)
  • Translate referenced/ref dynamic-page link slugs to the active locale so buttons/links point to the localized item URL
  • Left-align the read-only "Translating" element library to match the real element library
  • Move "Manage locales" to the top of the header locale dropdown

Test plan

  • Create a project with 2+ locales (e.g. EN default + FR) and a dynamic CMS page with translated slugs
  • Visit a CMS item in FR, switch to EN via the locale selector → URL uses the EN translated slug
  • Switch back to FR → URL uses the FR translated slug
  • Verify a link/button pointing to a CMS item resolves to the localized slug on a non-default locale
  • In the builder on a non-default locale, confirm the "Translating" sidebar is aligned with the element library
  • Confirm "Manage locales" appears at the top of the locale dropdown

- Resolve translated folder/page/CMS slugs in the locale selector so
  switching language preserves the correct path (fixes #340)
- Use the raw source slug as the default-locale value and per-locale
  fallback instead of the already-translated current-locale value
- Translate referenced/ref dynamic-page link slugs to the active locale
- Left-align the localizing element library to match the real library
- Move "Manage locales" to the top of the header locale dropdown
@tristan-mouchet tristan-mouchet added the Bug Something isn't working label Jun 9, 2026
@tristan-mouchet tristan-mouchet self-assigned this Jun 9, 2026
@tristan-mouchet tristan-mouchet merged commit cae59ab into develop Jun 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LocaleSelector doesn't translate CMS item slugs — keeps source-language slug on locale switch

1 participant