Can't save many translations + original in one save

According to the book saving many translation in one save should work but it doesn’t for me.

I’m using the ShadowTranslate behavior which is core compatible on the API level.

The problem is it is not saving the profiles table row at all and puts the same string in all of the translations and on top of that, it doesn’t save the third language.

Any ideas what I’m doing wrong?

/**
 * testSavingTranslations
 *
 * Testing that
 * - original record is saved
 * - all languages attached to it are saved
 * - associated models with translations are saved as well
 *
 * @return void
 */
public function testSavingTranslations() {
	Configure::write('Languages.available', [5, 2, 7]);

	$data = [
		'profile_title' => 'HANDEL ARCHITECTS LLP --- CHANGED',
		'keywords' => 'keywords --- CHANGED',
		'meta_description' => 'meta description --- CHANGED',
		'translations' => [
			5 => [
				'id' => 1,
				'locale' => 5,
				'profile_title' => 'locale 5 profile_title'
			],
			2 => [
				'id' => 1,
				'locale' => 2,
				'profile_title' => 'locale 2 profile_title'
			],
			7 => [
				'id' => 1,
				'locale' => 7,
				'profile_title' => 'locale 7 profile_title'
			]
		],
	];

	$entity = $this->Profiles->find('forBasicInfo', [
			'profileId' => 1,
		])
		->firstOrFail();

	$this->Profiles->patchEntity($entity, $data);

	foreach ($entity->translations as $lang => $translation) {
		$entity->translation($lang)->set($translation, [
			'guard' => false
		]);
	}

	$this->Profiles->save($entity);

	$entity = $this->Profiles->find('forBasicInfo', [
			'profileId' => 1,
		])
		->firstOrFail();

	debug($entity->_i18n);

	$this->assertEquals('HANDEL ARCHITECTS LLP --- CHANGED', $entity->profile_title);
	$this->assertCount(3, $entity->_i18n);
}

The debug output shows this, note that the locale is 0 for some reason as well.

########## DEBUG ##########
[
(int) 0 => object(App\Model\Entity\ProfilesTranslation) {

            'id' => (int) 1,
            'locale' => (int) 0,
            'profile_title' => 'HANDEL ARCHITECTS LLP --- CHANGED',
            'keywords' => 'keywords --- CHANGED',
            'meta_description' => 'meta description --- CHANGED',
            'team_description' => 'Handel Architects LLP Team is cool',
            'about' => 'Handel Architects LLP is an architecture, interior design, and planning firm that was founded in New York City in 1994. About Text is this...',
            '[new]' => false,
            '[accessible]' => [
                    '*' => true
            ],
            '[dirty]' => [],
            '[original]' => [],
            '[virtual]' => [],
            '[errors]' => [],
            '[invalid]' => [],
            '[repository]' => 'ProfilesTranslations'
    },
    (int) 1 => object(App\Model\Entity\ProfilesTranslation) {
            'id' => (int) 1,
            'locale' => (int) 0,
            'profile_title' => 'HANDEL ARCHITECTS LLP --- CHANGED',
            'keywords' => 'keywords --- CHANGED',
            'meta_description' => 'meta description --- CHANGED',
            'team_description' => 'Handel Architects LLP Team ist ein tolles Team...',
            'about' => 'Handel Architects LLP  hat einen sch├Ânen About Text hier...',
            '[new]' => false,
            '[accessible]' => [
                    '*' => true
            ],
            '[dirty]' => [],
            '[original]' => [],
            '[virtual]' => [],
            '[errors]' => [],
            '[invalid]' => [],
            '[repository]' => 'ProfilesTranslations'
    }

]
###########################