我想翻译一个用symfony的formbuilder创建的表单.由于我不想要一个大的翻译文件,它被分成了 "域".
现在我必须translation_domain为每个表单字段指定,否则symfony将查找错误的文件.这个选项必须添加到每个字段,我想知道是否有办法将此选项设置为整个表单?
示例代码我不满意:
$builder->add(
'author_name',
'text',
array('label' => 'Comment.author_name', 'translation_domain' => 'comment')
)->add(
'email',
'email',
array('label' => 'Comment.email', 'translation_domain' => 'comment')
)->add(
'content',
'textarea',
array('label' => 'Comment.content', 'translation_domain' => 'comment')
);
Run Code Online (Sandbox Code Playgroud)