Skip to content

Translations in ActionGroup not working as expected #7172

@Sajito

Description

@Sajito

Describe the bug
In my DashboardController I've set the translation domain to my_admin, which causes most translations to be loaded from that domain.
When creating a custom Action, that domain is also used.

But when using an ActionGroup, the translation for it's label is always loaded from messages unless I use a TranslatableMessage object with the correct domain.

Also any Action label used in that ActionGroup is not translated at all.

To Reproduce
Create a DashboardController and configure it's translation domain to be my_admin.
Create a CrudController and configure any custom action. Also configure an ActionGroup, to use the previously configured custom action.

Add the custom action directly and the action group to any page.

Check the translation page in the web profiler.

The label of the custom action rendered directly, will be loaded from my_admin.
The label of the action group, will be loaded from messages.
The label of the custom action inside the action group, will not be translated at all.

(OPTIONAL) Additional context

Example snippet to configure actions the actions.

$customAction = Action::new('custom', 'action.custom')
    ->linkToCrudAction('custom');

$actionGroup = ActionGroup::new('group', 'action.group')
    ->addAction($customAction);

return $actions
    ->add(Crud::PAGE_INDEX, $actionGroup)
    ->add(Crud::PAGE_INDEX, $customAction);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions