document-internationalization icon indicating copy to clipboard operation
document-internationalization copied to clipboard

Unpublish doesn't work for translated documents

Open sciencefidelity opened this issue 2 years ago • 4 comments

Plugin version 0.3.2 Studio version 2.30.1

Behaviour

Once a document is published and translated it is not possible to unpublish because of the references. I changed referenceBehavior to weak and updated previously published documents in Translation Maintenance, this allowed me to unpublisd the referenced document, but not the base language. By choosing Unpublish Anyway the toast gives this error:

An error occurred while attempting to unpublish this document. This usually means that there are other documents that refers to it.
Details
the mutation(s) failed: Document "0fb5807c-c5a0-4c05-8f90-00df3da42df7" cannot be deleted as there are references to it from "drafts.0fb5807c-c5a0-4c05-8f90-00df3da42df7__i18n_cy"

Expected Behaviour

It would be ideal if choosing unpublish on the base language would unpublish the base language and all translations.

sciencefidelity avatar Jun 10 '22 10:06 sciencefidelity

Looks as if the maintenance isn't updating the reference to be weak on BOTH the main and translated documents.

I was able to get around this simply by changing references to weak, and then republishing both the main and translated documents, which triggers the "updating i18n fields", which appropriately updates the references.

after this, I was able to unpublish both the base language and the translations.

I don't have the time to open a pull request on this as of right now but perhaps this can point someone in the right direction.

ehwarren avatar Nov 10 '22 01:11 ehwarren

I've had a similar issue with plugin v1.0.4 and studio v3.0. The issue here seems to be that this plugin creates strong references from and to translated items. Setting referenceBehavior to weak solves this for the translated versions, like @sciencefidelity said. If there are any other strong references pointing to a content item, the base language cannot be unpublished, unless those references are updated to be weak refs as well.

iainvdw avatar Feb 21 '23 10:02 iainvdw

how to change referenceBehavior have the same problem

kapyar avatar Mar 21 '23 18:03 kapyar

how to change referenceBehavior have the same problem

Add the following option under the documentInternationalization plugin config:

weakReferences: true

e.g.

documentInternationalization({
            supportedLanguages: [
                { id: "en", title: "English" },
                { id: "fr", title: "French" }
            ],
            schemaTypes: ["article", "experience", "project"],
            weakReferences: true // add this
        })

Designer023 avatar Jul 04 '23 11:07 Designer023