Skip to content

Commit cbbd2d9

Browse files
EmmanuelVellaisometriks
authored andcommitted
Use choice_translation_domain option (#1138)
1 parent 98e5b5f commit cbbd2d9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Resources/views/Form/fields.html.twig

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,13 @@
224224
<{{ tagName }}{% for attrname, attrvalue in label_attr_copy %} {{ attrname }}="{{ attrvalue }}"{% endfor %}
225225
{%- if disabled %} disabled="disabled"{% endif -%}>
226226
{{ form_widget(child, {'horizontal_label_class': horizontal_label_class, 'horizontal_input_wrapper_class': horizontal_input_wrapper_class, 'attr': {'class': attr.widget_class|default('') }}) }}
227+
{% if choice_translation_domain is not defined %}
228+
{% set choice_translation_domain = translation_domain %}
229+
{% endif %}
227230
{% if widget_type == 'inline-btn' or widget_checkbox_label == 'widget'%}
228-
{{ translation_domain is same as(false) ? child.vars.label|raw : child.vars.label|trans({}, translation_domain)|raw }}
231+
{{ choice_translation_domain is same as(false) ? child.vars.label|raw : child.vars.label|trans({}, choice_translation_domain)|raw }}
229232
{% else %}
230-
{{ translation_domain is same as(false) ? child.vars.label : child.vars.label|trans({}, translation_domain) }}
233+
{{ choice_translation_domain is same as(false) ? child.vars.label : child.vars.label|trans({}, choice_translation_domain) }}
231234
{% endif %}
232235
</{{ tagName }}>
233236
{% if widget_type not in ['inline', 'inline-btn'] %}
@@ -273,7 +276,10 @@
273276
{% if form.parent != null and 'choice' not in form.parent.vars.block_prefixes %}
274277
{% if label_render %}
275278
{% if widget_checkbox_label in ['both', 'widget'] %}
276-
{{ translation_domain is same as(false) ? label|raw : label|trans({}, translation_domain)|raw }}
279+
{% if choice_translation_domain is not defined %}
280+
{% set choice_translation_domain = translation_domain %}
281+
{% endif %}
282+
{{ choice_translation_domain is same as(false) ? label|raw : label|trans({}, choice_translation_domain)|raw }}
277283
{% else %}
278284
{{ block('form_help') }}
279285
{% endif %}

0 commit comments

Comments
 (0)