Skip to content

[Twig] Let Twig autocomplete trans parameters #528

Open
@rvanlaak

Description

@rvanlaak

While working with the 'Symfony2: Extract Translation Key' window, we replace the parameters in the Twig template so it can be extracted to the .yml file directly without having to leave the Twig template.

So, we already replace the variables with placeholders:

<title>Backend - Edit user {{ user.name }}</title>

Will first be modified to:

<title>Backend - Edit user %userName%</title>

And thereafter the translation is extracted by using the 'Symfony2: Extract Translation Key' window we did put on a keyboard shortcut. That way we stay in the Twig template, and only need to pass the username to the translation.

<title>{{ 'backend.edit_user.title'|trans }}</title>

Will the plugin be able to recognize the %userName% parameter for the autocomplete? And it would be nice if the cursor should be placed right after the trans filter. That way autocomplete could make it way easier to extract translations:

<title>{{ 'backend.edit_user.title'|trans({'%userName': user.name}) }}</title>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions