While you can run Kirby commands from the CLI, you can also create a custom Kirby Janitor command to translate content and run it from the Panel.

Create a field in your blueprint that triggers the Janitor command:
label: Translate Files Metadata
type: janitor
command: janitor-translate-files --language de
Create the Janitor command in your site/commands folder:
use Bnomei\Janitor;
use Kirby\CLI\CLI;
return [
'description' => 'Translates all files metadata of a specific page.',
'args' => [
'language' => [
'longPrefix' => 'language',
'description' => 'The target language to translate the content to.',
'required' => true
]
] + Janitor::ARGS,
'command' => static function (CLI $cli): void {
$kirby = $cli->kirby();
$defaultLanguage = $kirby->defaultLanguage()->code();
$targetLanguage = $cli->arg('language');
$page = $kirby->page($cli->arg('page'));
foreach ($page->files() as $file) {
$translator = $file->translator();
$translator->copyContent($targetLanguage, $defaultLanguage);
$translator->translateContent($targetLanguage, $targetLanguage, $defaultLanguage);
}
Janitor::singleton()->data($cli->arg('command'), [
'status' => 200,
'message' => 'Files translated successfully!'
]);
}
];
The command receives the current page context from Janitor, making it easy to create page-specific translation buttons in your blueprints.