Skip to content

[Translation] Disable translation of labels when expanded is used and choice_translation_domain is false #15140

@n0rbyt3

Description

@n0rbyt3

Hi,

I use an entity field type and the choice_label option to render the label of the field "title". The "title" column contains a fully localized string, but when using the {{ form_label }} inside twig, the title will be translated using the messages domain (and marked as missing in the profiler). This can result to unexpected labels.

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('groups', 'entity', array(
        'class' => 'MyTestBundle:Group',
        'choice_label' => 'title',
    ));
}

There should be a way to disable the translation of the label completely and show the label as-is, but escaped. Setting "translation_domain" or "choice_translation_domain" to FALSE (as it should be done to disable labels completely) has no impact. The only workaround I have found is to use a non-existing domain, but this is a hack and will also call the translator. I also don't want to override the default label widget.

Disabling the translation of labels could also improve performance because no message catalogues have to be read by the translator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions