Skip to content

Commit

Permalink
bug #5973 Fix untranslateable Help texts in crud view. (nopenopenope)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.x branch.

Discussion
----------

Fix untranslateable Help texts in crud view.

This configuration in a CrudController (1) leads to this result (2). The expected output however is a translated/translatable help line (3).

This PR will allow Help texts to be translated properly with the given parameters in a Crud overview.

1. Code Configuration in Crud:
![grafik](https://github.com/EasyCorp/EasyAdminBundle/assets/6654389/54bdb670-b6b9-46b2-afcd-79011d1ce124)

2. Result:
![grafik](https://github.com/EasyCorp/EasyAdminBundle/assets/6654389/2d9fc097-4c09-4209-98e5-20c127d0f633)

3. Expectation (the Help is translated)
![grafik](https://github.com/EasyCorp/EasyAdminBundle/assets/6654389/452cb3e3-1c9e-4154-b428-f55b2d4243fd)

Bug is reproducible in 4.8.0 tag.

This PR allows for both usage of `t()` method and plain inputs to be translated by the Symfony translator automatically.

Commits
-------

c13fba0 Fix untranslateable Help texts in crud view.
  • Loading branch information
javiereguiluz committed Oct 26, 2023
2 parents e59d14c + c13fba0 commit 33a94b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Resources/views/crud/form_theme.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
{% if has_input_groups %}</div>{% endif %}

{% if field.help ?? false %}
<small class="form-help">{{ field.help|raw }}</small>
<small class="form-help">{{ field.help|raw|trans(label_translation_parameters, translation_domain) }}</small>
{% elseif form.vars.help ?? false %}
<small class="form-help">{{ form.vars.help|trans(form.vars.help_translation_parameters, form.vars.translation_domain)|raw }}</small>
{% endif %}
Expand Down

0 comments on commit 33a94b7

Please sign in to comment.