In saveTranslation
function of the ContentEntitySource
, it loads the job's entity and pass it to the doSaveTranslations
. However, it doesn't load the correct translation based on the job's source language so it will default to the node's source language. In our case, we use paragraphs_asymmetric_translation_widgets so paragraph structure could be different between the node's source language and job's source language and that causes a field mismatch error when trying to save a translation job as completed.
Enable tmgmt and paragraphs_asymmetric_translation_widgets. Create a node (langcode: en) with nested paragraph fields (e.g. Paragraph type A, Paragraph type B), then create a translation of the node (langcode: en-au) with nested paragraph fields (e.g. Paragraph type C). Request a translation of the node from en-au -> fr and the exported node data will be created based on en-au so Paragraph type C's fields will show in the translation xliff file.
If you import the completed xliff file and try to save the job as completed, it will error out as it will load the en version of the node when executing the saveTranslation
In saveTranslation
, the job's source language should be taken into consideration when loading the entity. Plus, it should do no harm to people who doesn't use paragraphs_asymmetric_translation_widgets.
Something like: $entity->getTranslation($job_item->getJob()->getSourceLangcode())
Needs review
1.0
Source: Entity
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.