Dynamically switch I18n locale?

Hi,

ruby '2.5.0’
dry-validation gem (0.11.1)
gem ‘rails’, '~> 5.1.4’
gem 'i18n-country-translations’
gem ‘rails-i18n’, '~> 5.0.0’
gem 'i18n-js’
gem 'simple_form’
gem 'cells-rails’
gem "trailblazer-cells"
gem 'cells-slim’
gem 'trailblazer-operation’
gem 'reform-rails’
gem ‘trailblazer’, git: ‘https://github.com/trailblazer/trailblazer’, ref: 'e6d37f2’
gem 'dry-struct’
gem 'dry-validation’
gem ‘dry-matcher’

In my Rails 5 project I switch the I18n.locale dynamically - in a controller. The dry-validation gem (0.11.1) does not switch its own messages locale. I had to restart Rails server for changes to take effect.

How to solve this problem?

I also use Trailblazer in this project - not sure if its relevant.

You can pass locale explicitly to .messages: Schema.(params).messages(locale: I18n.locale)