如何在 Symfony 4 中为给定的区域设置提供表单字段/消息?
How can I make form fields / messages available for given locale in Symfony 4?
我在 Symfony 4 中创建了一个表单:
$form = $this->createFormBuilder($item)
->add('username', TextType::class, array('attr' => array('class' => 'form-control')))
但现在我收到 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.
所以我通过 composer 安装了 Symfony 翻译,我仍然找不到 "catalogue" 而且如果我只有一种语言,为什么我需要将它添加到目录中
在 Profiler 中,您可以看到 symfony 正在寻找哪个目录。通常验证可以在验证器目录中找到,这意味着您需要在翻译文件夹中添加一个 validators.LOCALE.yml(语言环境必须是您使用的语言环境,例如 en)。但是要查找正确的目录!
我在 Symfony 4 中创建了一个表单:
$form = $this->createFormBuilder($item)
->add('username', TextType::class, array('attr' => array('class' => 'form-control')))
但现在我收到 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.
所以我通过 composer 安装了 Symfony 翻译,我仍然找不到 "catalogue" 而且如果我只有一种语言,为什么我需要将它添加到目录中
在 Profiler 中,您可以看到 symfony 正在寻找哪个目录。通常验证可以在验证器目录中找到,这意味着您需要在翻译文件夹中添加一个 validators.LOCALE.yml(语言环境必须是您使用的语言环境,例如 en)。但是要查找正确的目录!