lib/dry/schema/messages/i18n.rb in dry-schema-1.4.2 vs lib/dry/schema/messages/i18n.rb in dry-schema-1.4.3
- old
+ new
@@ -31,22 +31,22 @@
def get(key, options = EMPTY_HASH)
return unless key
opts = { locale: options.fetch(:locale, default_locale) }
- translation = t.(key, opts)
+ translation = t.(key, **opts)
text_key = "#{key}.text"
if !translation.is_a?(Hash) || !key?(text_key, opts)
return {
text: translation,
meta: EMPTY_HASH
}
end
{
- text: t.(text_key, opts),
+ text: t.(text_key, **opts),
meta: extract_meta(key, translation, opts)
}
end
# Check if given key is defined
@@ -119,10 +119,10 @@
end
def extract_meta(parent_key, translation, options)
translation.keys.each_with_object({}) do |k, meta|
meta_key = "#{parent_key}.#{k}"
- meta[k] = t.(meta_key, options) if k != :text && key?(meta_key, options)
+ meta[k] = t.(meta_key, **options) if k != :text && key?(meta_key, options)
end
end
end
end
end