$is_changed = TRUE;
} elseif (!
$existing_translation && !
empty($new_translation_string)) { // Newly entered translation.
$is_changed = TRUE;
} if ($is_changed) { // Only update or insert if we have a value to use.
$target =
$existing_translation_objects[$lid] ??
$this->localeStorage->
createTranslation(['lid' =>
$lid, 'language' =>
$langcode]);
$target->
setPlurals($new_translation['translations'
]) ->
setCustomized() ->
save();
$updated[] =
$target->
getId();
} if (empty($new_translation_string) &&
isset($existing_translation_objects[$lid])) { // Empty new translation entered: remove existing entry from database.
$existing_translation_objects[$lid]->
delete();
$updated[] =
$lid;
} } $this->
messenger()->
addStatus($this->
t('The strings have been saved.'
));