Method: JSONSchemer::Result#i18n!

Defined in:
lib/json_schemer/result.rb

#i18n!Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/json_schemer/result.rb', line 55

def i18n!
  base_uri_str = source.schema.base_uri.to_s
  meta_schema_base_uri_str = source.schema.meta_schema.base_uri.to_s
  error_key = source.error_key
  I18n.translate!(
    source.absolute_keyword_location,
    :default => [
      "#{base_uri_str}#{I18N_SEPARATOR}##{resolved_keyword_location}",
      "##{resolved_keyword_location}",
      "#{base_uri_str}#{I18N_SEPARATOR}#{error_key}",
      "#{base_uri_str}#{I18N_SEPARATOR}#{CATCHALL}",
      "#{meta_schema_base_uri_str}#{I18N_SEPARATOR}#{error_key}",
      "#{meta_schema_base_uri_str}#{I18N_SEPARATOR}#{CATCHALL}",
      error_key,
      CATCHALL
    ].map!(&:to_sym),
    :separator => I18N_SEPARATOR,
    :scope => I18N_ERRORS_SCOPE,
    **interpolation_variables
  )
end