Skip to content

Creating page drafts in secondary locales when sync is enabled exhibits buggy behaviour #13090

Closed
@MaciekBaron

Description

@MaciekBaron

Issue Summary

When using simple translation with sync enabled, if you create a draft of a page using a secondary locale (i.e. not the primary, default locale), you are unable to correctly access other language versions of the draft.

For instance, imagine you have English and Welsh. Your primary language is English. If you create a draft page in Welsh, it also appears within the English page tree. However, when you click on that page, you get taken to the Welsh version. Moreover, if you use the locale switcher and choose English, you are redirected to the Welsh version.

Technically what seems to be happening is that two draft pages are created, but both of them seem to show the Welsh locale, even if one exists under the English page tree.

What's worth noting is that normally when you create an English page, the English page has id X and the Welsh page has X + 1. When you create the Welsh page, its id is X, but the "English" page with id X + 1 also technically exists, however when opened in the admin panel, it shows the Welsh version (or at least the locale shown is Welsh - I'm going to refer to this faux English version using quotation marks - "English"). At this point you can edit the Welsh version (id = X) and those changes will not be carried over to the "English" version (id = X + 1) but when you edit the "English" version (id = X + 1) the changes are applied to the Welsh version instead (id = X). The "English" version will always show the initial version of what the Welsh version had during its first iteration. Again, this all gets "fixed" when you publish the page.

Steps to Reproduce

Ensure that the following settings are applied, and that you added an additional locale in the admin panel:

USE_I18N = True
WAGTAIL_I18N_ENABLED = True

LANGUAGE_CODE = "en-gb"
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
    ("en-gb", _("English")),
    ("cy", _("Welsh")),
    ("uk", _("Ukrainian")),
]

WAGTAILSIMPLETRANSLATION_SYNC_PAGE_TREE = True
  1. Create any page under a non-primary locale (e.g. Welsh)
  2. Save as a draft
  3. Switch to the English locale
  4. Notice that it still displays the same page and locale (e.g. Welsh), even if the ID is different
  5. Go to the English page tree
  6. Notice that the page exists there
  7. However, when you click it it, it opens the page and says it is the other locale (e.g. Welsh), even id the ID is different
  8. Once you publish the page, everything starts working as expected

What I expect to happen is one of the following:

  • The draft page does not appear under the English page tree, and I am unable to switch to the English locale
  • The draft page does appear under the English page tree, and when I click I am informed that it is an alias of the Welsh page which can be converted (the same behaviour as when the article is published)
  • The draft page does appear under the English page tree, and when I click I am informed that the Welsh version is still a draft and I cannot edit the English version (if this was the originally intended behaviour)

I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: YES

Technical details

python = "^3.12"
django = "~5.1.8"
wagtail = "~6.4"

Working on this

Anyone can contribute to this. View our contributing guidelines, add a comment to the issue once you’re ready to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:i18ni18n for content created in Wagtail, not the admin UI itselftype:Bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions