lib/dry/schema/messages/i18n.rb in dry-schema-0.1.1 vs lib/dry/schema/messages/i18n.rb in dry-schema-0.2.0
- old
+ new
@@ -7,10 +7,24 @@
#
# @api public
class Messages::I18n < Messages::Abstract
attr_reader :t
- ::I18n.load_path.concat(config.paths)
+ configure do |config|
+ config.root = 'dry_schema.errors'.freeze
+ config.rule_lookup_paths = config.rule_lookup_paths.map { |path| "dry_schema.#{path}" }
+ end
+
+ # @api private
+ def self.build(paths = config.paths)
+ set_load_paths(paths)
+ new
+ end
+
+ # @api private
+ def self.set_load_paths(paths)
+ ::I18n.load_path.concat(paths)
+ end
# @api private
def initialize
super
@t = I18n.method(:t)