fix(edit-content): locale translation fixes — preserve HOST_FOLDER & RELATIONSHIP, resolve related items to target language#35738
Conversation
…nual locale translation, resolve related items to target language - Binary fields are now cleared on both populate and manual translate (re-upload required per locale) - HOST_FOLDER and RELATIONSHIP fields are preserved on manual translate - Related items resolve to their target-language version on both populate and manual translate; falls back to the original if no translation exists - Language column in the relationship table now renders correctly after locale resolution (LanguagePipe expects DotLanguage object, not a string) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @adrianjm-dotCMS's task in 4m 2s —— View job Code Review
Overall the diagnosis is solid and the fixes match the root causes described. A few things worth a second look: 1.
|
…p field CI test failures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vent loss of data - Added logic to load tag associations from the tag_inode table before clearing the inode in the EditContentletAction class. This ensures that the setTags() method can find the tags correctly, preventing potential data loss during the content editing process.
|
@claude Code review here please |
This comment was marked as resolved.
This comment was marked as resolved.
…le-resolution tests, add fallback comment, fix Java style - Rename $isPreservedField → isPreservedField ($ prefix reserved for signals/computed) - Add test coverage for relationship store locale resolution branches: targetLanguageId + items calls getContentById per item, patches language to DotLanguage, catchError falls back to original item, null contentlet uses existingData, early-return when no targetLanguageId or empty data - Add comment on catchError fallback explaining blank language column is expected - Expand Java try/catch to multi-line block for consistency Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Screen.Recording.2026-05-19.at.11.42.41.AM.mov
Summary
Fixes several bugs in the locale translation flow (populate & manually translate) for the edit content form.
writeValue(null)alone is not enough, so the binary component is flushed (destroyed + recreated) to reset its internal visual stateFormControlbefore reinit and restored aftercatchErrorfallback)LanguagePipeexpects aDotLanguageobject butgetContentByIdreturnslanguageas a plain string; the resolved item is patched with the fullDotLanguageobject before it hits the storesetInode("")was called beforesetTags(), so the tag lookup by inode returned nothing; tags are now loaded fromtag_inodebefore the inode is clearedRoot causes
#flushFieldsForRerender()was only called for manual translation, not populatecontentlet = nulloverwrites all controls; no capture/restoregetContentByIdreturnslanguageasstring, notDotLanguage; pipe returns''for stringssignalMethodwas called withthis.$inputs()(a value, one-shot) instead ofthis.$inputs(signal ref, reactive); component is preserved songOnInitdoesn't re-runcontentlet.setInode("")ran beforecontentlet.setTags(); tag lookup uses the inode so it returned nothingTechnical approach
prepareContentletForCopyaccepts an optionalfieldsparam and nulls out allBINARYfield valuesdot-edit-content-formgains$shouldRenderPreservedFieldssignal and#preservedFieldTypesOnManualTranslationarray (HOST_FOLDER,RELATIONSHIP); manual translation uses a selective flush that only destroys non-preserved field componentsRelationshipFieldStore.initializecapturesstore.data()before the reset with amapoperator, uses those items as fallback whencontentletis null (manual translation), and patches each fetched item'slanguageto the fullDotLanguageobjectEditContentletAction.retrieveWebAssetnow callssibbling.setTags()beforesetInode("")so the tag-to-inode associations are loaded while the original inode is still availableTest plan
This PR fixes: #35534
This PR fixes: #35532