1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SymfonyAdvent Calendar 2023

Day 9

symfonyでvalidationのメッセージを日本語化したメモ

Posted at

基本は ↑ こちらに沿って進めればOK

symfony/translation で配置されるファイルは ↑ こちら

↑ こちらにあるとおり、 validators.ja.xlf を translations/ ディレクトリにコピーします

ただ、各リンクのとおりに進めても、invalidのメッセージは英語のままでした

ファイル名の形式が translation_domain.言語.xlf となっているみたいで、
validator.yaml の translation_domain と合わせる必要があります

# config/packages/validator.yaml
framework:
    validation:
-        translation_domain: validation_errors
+        translation_domain: validators

これで日本語になりました

ごきげんよう

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?