How do I override or replace a default translation of a flash message in EasyAdmin?
I want to change the text that is shown when an entity is deleted for one Crud Controller but don't know how.
Writing a custom twig file seems excessive when I just want to replace a text.
I'm using easyadmin-bundle: 4.6
I could not overwrite the translation so i removed the delete action and added my own action in the crud controller:
public function configureActions(Actions $actions): Actions
{
$actions = parent::configureActions($actions);
$actions->remove(Crud::PAGE_INDEX, Action::DELETE);
$actions->add(Crud::PAGE_INDEX, $this->archiveAction());
return $actions;
}
private function archiveAction(): Action
{
return Action::new('archive', 'action.archive')
->linkToCrudAction('archiveEntity')
->setHtmlAttributes([
'onclick' => 'return confirm('Do you want to archive this item?']);
}