2

I'm in a project where I'm using the gem trailblazer(and by that, I'm using reform too) with dry-validations. And kind of found how to translate error messages - I'm putting config.messages = :i18n inside each contract/reform class, since I didn't find how to configure it glogablly to every reform class I have.

BUT, at least, I did reached it.

Now, I'm trying to figure out how to translate my reform class's properties and "model_name". The great would be to just configure it to use the model's translations(e.g.: UserForm being translated just as User model), but I didn't even find the format to write the locales for my reform classes.

So, what I want to do is: - Make reform classes give the same translations as it's respective models - OR know the structure of reform's locales ymls

Kleber NG
  • 107
  • 1
  • 6

1 Answers1

0

For a global configuration on Rails 7 with the Reform gem. I do the next in config/initializers/reform.rb

Dry::Validation::Contract.config.messages.load_paths << 'config/locales/es.yml'
Dry::Validation::Contract.config.messages.load_paths << 'config/locales/en.yml'
Dry::Validation::Contract.config.messages.default_locale = I18n.locale