Skip to content

Issue with 'label' key in an array (outside of the Symfony Form context) [SF4] #71

@noofaq

Description

@noofaq

I have just started to review of your bundle to replace nearly dead JMSTranslationBundle (even if I have succeded to make it work in SF4 it does not give any hope for long-term usage).

I have some lines in Symfony4 controller - used to build some breadcrumbs. I have to translate them in controller as they are built with some translateable strings (like shown below "Users" string) and also non-translateable. I am (it seems unfortunately) using 'label' key in breadcrumb array which causes errors in translation:extract Symfony Command.

Code from controller (both lines fail, however 'breadcrumb.users' string is correctly added to the dictionairy):

$params['breadcrumbs'][] = ['label' => $this->get('translator')->trans('breadcrumb.users'), 'route' => 'app_parameters_user_index'];
$params['breadcrumbs'][] = ['label' => $user->getNameAndSurname()];

It seems default extractor looks for "label" field in an array despite the real context (JMSTranslationBundle was smarter in this case).

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