How to translate node programmatically with correct revision translation affected value? I have a question about create node translation programmatically.

First of all, the following is the database screenshot when we use drupal UI to create the translation.

The revision_translation_affected will be set to the language each time when the new one is created. 

For example, I create an English article and then translate it with Chinese.



We can see the revision translation affected has been set with the Chinese version because of the translation is the latest created.

However, I use the following code to create a node and add the translation.

$post = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;create(
        [
            'type' =&gt; 'page',
            'title' =&gt; 'test title',
            'langcode' =&gt; 'en'
        ]
    );
    $post-&gt;save();
    $source_translation = $post-&gt;getTranslation('en');
    $target_translation = $post-&gt;addTranslation('zh-hant', $source_translation-&gt;toArray());
    $target_translation-&gt;save();


I got the following database result



This result will cause the revision confusion when we want to see the revision record from each translation.

Does anyone have experience on how to handle this issue?
I just ran into this and this prevented my translated revision also appearing as a revision of my original:
$langcode = 'fr';
$node-&gt;setRevisionTranslationAffected(FALSE);
$node-&gt;addTranslation($langcode, ['title' =&gt; $node-&gt;getTitle()])-&gt;save();