Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Translations for the fields #7

Open
cboelter opened this issue Apr 11, 2022 · 1 comment
Open

Using Translations for the fields #7

cboelter opened this issue Apr 11, 2022 · 1 comment
Labels

Comments

@cboelter
Copy link
Contributor

I'm not really that this is a bug or a user problem :-) ... to have translations for my fields I'm currently using stuff like this.

->add(
'field',
 TextType::class,
[
  'label'        => $this->translator->trans(
      'test.form.sale_upload.promotion.0',
      [],
      'contao_test',
      'de'
    ),
....

If I leave the label and help options blank, the label is not rendered in the frontend. I excepted something like field-name as label. Is it possible to use the Fields without a label in the config and using the translator directly in the form_theme?

@dmolineus
Copy link
Member

I did not understand your issue correctly. Usually you can setup a translation domain and the label is automatically translated. You have to pass the translation key as label then. https://symfony.com/doc/current/reference/forms/types/form.html#label-translation-parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants