By default, this plugin creates a strong reference between a document and its connected translation metadata document. Because reference integrity is maintained by the API, you cannot delete a document that has a strong reference to it.
To offset this difficulty, the plugin exports a document action that will allow you to remove the translation reference from the action, before proceeding to delete the document. It is not added by default to your schema types.
Import into your Studio's config file
import {
documentInternationalization,
DeleteTranslationAction,
} from '@sanity/document-internationalization'
export default defineConfig({
// ...all other config
document: {
actions: (prev, {schemaType}) => {
// Add to the same schema types you use for internationalization
if (['page'].includes(schemaType)) {
// You might also like to filter out the built-in "delete" action
return [...prev, DeleteTranslationAction]
}
return prev
},
},
})
The metadata document also contains a "Delete all translations" document action which is queued by default for only that schema type. It will delete all of the documents in the translations
array of references, as well as the metadata document itself.