Page::create() with translated content?

I am creating pages from a csv in a multi language setup. I couldn’t find any documentation on where to put the translations. Right now i would update the returned page after I created it, but I am sure there is a way doing it right within the Page::create() function.
I suppose I am asking for the correct layout of the translations array?

Here is my code so far:

foreach ($csv as $project) {
          $page = Page::create([
            'slug'     => Str::slug($project['Title_EN']),
            'template' => 'project',
            'parent' => $parent,
            'content' => [
              'title' => $project['Title_EN'],
              'client' => $project['Client_EN'],
              'type' => $project['Type_EN'],
              'year' => $project['Year'],
              'description' => $project['Description_EN'],
              
            ],
            # 'translations' => [ ????? ]
          ]);
        }

You can use translations index like following syntax:

$page = new Page([
	'slug'         => Str::slug($project['Title_EN']),
	'template'     => 'project',
	'parent'       => $parent,
	'translations' => [
		'en' => [
			'code'    => 'en', 
			'content' => [
			    'title'       => $project['Title_EN'],
			    'client'      => $project['Client_EN'],
			    'type'        => $project['Type_EN'],
			    'year'        => $project['Year'],
			    'description' => $project['Description_EN'],
			]
		], 
		'de' => [
			'code'    => 'de', 
			'content' => [...]
		] 
	]
]);
1 Like

Even with the translations added, the page will still be only created in the default language.