AI Translate: LbFieldExtractor adds translations with default values for empty fields.

Created on 1 September 2025, about 24 hours ago

Problem/Motivation

AI Translate: LbFieldExtractor adds translations with field's default values if these fields are empty in the original block entity.

Steps to reproduce (required for bugs, but not feature requests)

Please provide information like AI modules enabled, which AI provider, browser, etc.
Let's say we have a block component having multiple fields. In the field settings we have set some default values for these fields, but these fields are not required.
So when we add the block and keep any field blank and also remove the default values and saves it, and then we add generate the AI translations, The fields which are empty empty are now filled with field's default values in the translated version.

Proposed resolution

Change the code from

      $blockEntity = $blockEntity->hasTranslation($translationLanguage)
        ? $blockEntity->getTranslation($translationLanguage)
        : $blockEntity->addTranslation($translationLanguage);

to

     $blockEntity = $blockEntity->hasTranslation($translationLanguage)
        ? $blockEntity->getTranslation($translationLanguage)
        : $blockEntity->addTranslation($translationLanguage, $blockEntity->toArray());

Remaining tasks

Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)

๐Ÿ› Bug report
Status

Active

Version

1.2

Component

AI Translate

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia anmolgoyal74

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024