Files
terminus/app/contract.rb
T
Brooke Kuhlmann cd4905dc9c Added contract i18n load paths
Brings the configuration in line with Hanami 3.0.0 internationalization defaults by first loading the shared paths and then the load paths. Unfortunately, Hanami's default load paths are relative paths with glob syntax so we have to strip off the globs before adding with our specific globs. This is because Hanami supports different file formats but Dry Validation on supports YAMLs.

Milestone: patch
2026-07-06 08:47:12 -06:00

18 lines
442 B
Ruby

# frozen_string_literal: true
require "dry/validation"
module Terminus
# Defines user create contract.
class Contract < Dry::Validation::Contract
config.messages.backend = :i18n
Hanami.app.config.i18n.tap do |i18n|
(i18n.shared_load_path + i18n.load_path).each do |entry|
path = Hanami.app.root.join entry.sub(/\*.*/, "")
config.messages.load_paths.merge path.glob("**/*.yml")
end
end
end
end