Dry::Validation::Result#messages ignore locale option

Hi there,
I have encountered an issue that seems not present for dry gems < 1.0

In the image above I have @results which is an array of Dry::Validation::Contract class where I have already called call with input.

I’m trying to verify that when I do something like this:

class MySchema < Dry::Validation::Contract
  config.messages.load_paths << 'my_file.yml'
  params do
    required(:title).filled
  end
end

result = MySchema.call({})
result.errors(locale: :de) -> returns the de version
result.messages(locale: :de) -> returns the de version but it doesn't and returns the en version

Here a portion of my error file:

en:
  dry_validation:
    errors:
      filled?: "must be filled"


de:
  dry_validation:
    errors:
      filled?: "muss abgefüllt sein"

Am I missing something or there is an issue with the message method?

Please report a bug on github.

Ok thanks, here it is: https://github.com/dry-rb/dry-validation/issues/589

1 Like