👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Discussion of missing translated documents and issues with the document internationalization plugin

12 replies
Last updated: Sep 19, 2022
Hi Sanity. This morning we tried to fix some translation references for documents by using https://github.com/sanity-io/document-internationalization/blob/main/docs/translation-maintenance.md , with the end result that the translated documents are now completely gone (while the base translation document is still in place). The references themselves seem to still be in place in the dataset, but the actual documents are nowhere to be found.
Is there any way for us to restore these documents? Should we avoid using translation maintenance to fix translation reference issues? And/or should we use strong references to avoid similar behaviour in the future when trying to fix references?
Aug 22, 2022, 9:13 AM
Hello
user U
Where did you check for the original docs? What do you mean it’s still in place? Did you query for them and see if they are still there? There are many many roads to getting things back and I cannot see, what you mean with deleted. If a reference is still in place, the docs are still there.

But without more inforamation we will not be able to answer. +
Aug 22, 2022, 4:17 PM
Hi Saskia. Thanks for getting back. To clarify -• The base document still exists and is available within the Sanity studio UI and API
• The translated documents (that were previously referenced from the base document) (
i18n.[...].[locale]
) are no longer visible from within the Sanity Studio UI.• We did find a way to find the translated documents by looking up transactions, and then querying each single translated document one-by-one.
Surprised by how translation maintenance can result in 300+ documents missing as part of it's "fix behavior", but again it might be due to the type of reference we're using (weak)?

Via the transactions API I see similar transactions to the one below for all of the documents that went missing:

  "id": "frfQR1pcDXW7QBTcyUY7FK",
  "timestamp": "2022-08-22T07:31:12.735179Z",
  "author": "[id]",
  "mutations": [
    {
      "delete": {
        "id": "i18n.cd505c82-4aab-4b64-8eff-[...].da",
        "purge": false
      }
    }
  ],
  "documentIDs": [
    "i18n.cd505c82-4aab-4b64-8eff-[...].da"
  ]
}
Aug 22, 2022, 4:51 PM
okay, then the issue must lie in your studio setup … could you provice us more information around that?for example: where in the sanity UI did they disappear from? Was everything work before with the plugin?
Aug 23, 2022, 10:35 AM
• The translated documents disappeared from the document-internationalization dropdown in top right corner. I.e. localisation for each language were shown as "not created", and upon click they would be re-created from the base document. When we did that we were in fact able to see and restore from previous history (most likely due to the fact that the id was the same as before).• Once published (after restoring) the document history was reset, and now it looks like the document was created when it was restored.
• The plugin seems to have been working fine - except that we see quite a few documents show up under "translation maintenance" to be fixed, which is what we did yesterday - causing the issue to begin with.
Document internationalization config looks like this:

{
  "idStructure": "subpath",
  "referenceBehavior": "weak",
  "base": "en",
  "languages": [
    { "id": "da", "title": "Danish", "flag": "dk" },
    { "id": "de", "title": "German" },
    { "id": "en-GB", "title": "English (UK)", "flag": "gb" },
    { "id": "en", "title": "English", "flag": "gb" },
    { "id": "fr", "title": "French", "flag": "fr" },
    { "id": "nb", "title": "Norwegian", "flag": "no" },
    { "id": "sv", "title": "Swedish", "flag": "se" }
  ],
  "withTranslationsMaintenance": true
}
Aug 23, 2022, 11:02 AM
hm could you send a screenshot for us? this is very curious… We will have alook
Aug 23, 2022, 11:35 AM
(screanshots are needed, so we are sure which dropdown you mean etc.=
Aug 23, 2022, 11:37 AM
Yes. of course.
Aug 23, 2022, 12:00 PM
Here's a document where some translations have been created and are available. Others are not.
Aug 23, 2022, 12:02 PM
When fixing using "Translation Maintenance" what happened was that all translations except base translation went "inactive" - or whatever you want to call the "create new document translations" section 🙂 Also they were no longer in the dataset, but only to be found via the transactions and history api.
Aug 23, 2022, 12:03 PM
Hello
user U
sorry nobody came back to you, somehow this seems to have slipped off the table, so sorry for that.Can I still help you with this issue?
Sep 8, 2022, 8:15 PM
Hi Saskia. Thanks for following up on this. I've been in dialogue with Simeon regarding this, and I can see that a few re-workings of the document internationalisation plugin are on their way to avoid similar situations going forward.
Sep 19, 2022, 7:01 AM
Wonderful that Simeon is helping you 🙂Let’s mark this thread as resolved, and you can pose new questions in the usual way, if you need something else
Sep 19, 2022, 7:04 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?