Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the automatic creation of Wagtail Page Aliases in other locales #15066

Closed
wants to merge 1 commit into from

Conversation

stevejalim
Copy link
Collaborator

This changeset deliberately removes the after_create_page hook from wagtail_localize.synctree to avoid the default behaviour where adding a page in a locale creates Aliases in all other locales which then serve the soure locale's content but under a different locale path (eg /en-US/test-page/'s content appears on /fr/test-page/ because of the alias)

See changes to cms.rst in this changeset for more details

  • I used an AI to write some of this code: specifically, the approach to patching out the wagtail hook, but it seems to work well and I've added a test to protect against regressions

Issue / Bugzilla link

Resolves #15063

Testing

  • a[ ] On main, create a new page in the CMS, publish it.
  • Confirm you can see that page also created in all other locales (ping @stevejalim if you don't get this default behaviour).
  • If you edit one of those versions it will say it's an Alias and needs to be made into a page to edit it.
  • On this branch, create another new page and publish it.
  • Confirm you no longer have a crop of Aliases made in the other locales.
  • In the kebab/context menu for the page you made, click Translate this page and select one or two locales. Do not click the buttong related to Smartling and then submit/save
  • Confirm you can find versions of the source page in the page tree for the other locales. They will default to the en-US content for now, but you can edit them and publish new "localized" content in them
  • Stretch test: edit the source page again and republish. Use the kebab menu to sync translated content again. This should not error. View a localized version of the page and confirm that the source strings for the page have been synced over, and that a new translation is needed for that updated content.

Deliberately removes the after_create_page hook from wagtail_localize.synctree
to avoid the default behaviour where adding a page in a locale creates Aliases
in all other locales which then serve the soure locale's content but under
a different locale path (eg /en-US/test-page/'s content appears on /fr/test-page/
because of the alias)

See changes to cms.rst in this changeset for more details
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.89%. Comparing base (4e7a269) to head (fb7d806).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15066      +/-   ##
==========================================
+ Coverage   77.85%   77.89%   +0.03%     
==========================================
  Files         162      163       +1     
  Lines        8450     8463      +13     
==========================================
+ Hits         6579     6592      +13     
  Misses       1871     1871              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stevejalim
Copy link
Collaborator Author

See comment on #15063

@stevejalim stevejalim closed this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not add Aliases for translated pages if they are not ticked for actual translation
1 participant