Consider how to resolve the issue of duplicated localized documents uploading to the same folder on Crowdin.
This is resolved in your Payload installation by adding an appropriate logic in a beforeDuplicate hook:
const beforeDuplicate: BeforeDuplicate<LandingPage> = ({ data }) => {
return {
...data,
// prevent this landing page from localizing to the same folder on Crowdin
...(data.crowdinArticleDirectory && {
crowdinArticleDirectory: null,
})
}
}
Expecting the user to modify their configuration is not ideal. I can currently think of two better possibilities:
Can beforeDuplicate be defined as an array? Seems to be an object so hooks cannot be merged. Change to Payload CMS?
Modify plugin behaviour to no longer modify existing documents. Details as follows.
This could be resolved if we move to a version of this plugin that doesn't modify the original document (i.e. we store data in our own collections - we don't modify existing documents by adding a crowdinArticleDirectory relationship field). In this case, CrowdinArticleDirectorydocuments will link to a specific document. When duplicated, a document will have a new id so this will no longer be an issue.
Consider how to resolve the issue of duplicated localized documents uploading to the same folder on Crowdin.
This is resolved in your Payload installation by adding an appropriate logic in a
beforeDuplicate
hook:Expecting the user to modify their configuration is not ideal. I can currently think of two better possibilities:
beforeDuplicate
be defined as an array? Seems to be an object so hooks cannot be merged. Change to Payload CMS?This could be resolved if we move to a version of this plugin that doesn't modify the original document (i.e. we store data in our own collections - we don't modify existing documents by adding a
crowdinArticleDirectory
relationship field). In this case,CrowdinArticleDirectory
documents will link to a specific document. When duplicated, a document will have a new id so this will no longer be an issue.