How can I make form fields / messages available for given locale in Symfony 4?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How can I make form fields / messages available for given locale in Symfony 4?



I created a form in Symfony 4:


$form = $this->createFormBuilder($item)

->add('username', TextType::class, array('attr' => array('class' => 'form-control')))



But now I get an error message for username.


username



These messages are not available for the given locale and cannot be
found in the fallback locales. Add them to the translation catalogue
to avoid Symfony outputting untranslated contents.



So I installed Symfony translation via composer, I still cannot find the "catalogue" and also why do I need to add this to a catalogue if I only have one language




1 Answer
1



In the Profiler you can see which catalogue symfony is looking for. normally validation is found in the validators catalogue, which means you need to add a validators.LOCALE.yml (locale must be the locale you are using ex. en) in the translations folder. But look up the right catalogue!





I do not see any indication in the profiler for the catalogue: i.imgur.com/Btv7k68.png
– Jarla
Aug 6 at 14:04





the catalouge is in the domain colum.
– fucethebads
Aug 6 at 14:06





Ok, this means, the catalogue name is "messages". So if I understand you right, then I have to add this file: config/packages/validators.LOCALE.yml
– Jarla
Aug 6 at 14:14


config/packages/validators.LOCALE.yml






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard