module Formeze::Errors

Constants

DEFAULT
SCOPE

Public Class Methods

translate(error, scope:) click to toggle source
# File lib/formeze/errors.rb, line 17
def self.translate(error, scope:)
  default = DEFAULT[error] || 'is invalid'

  return default unless defined?(I18n)

  message = I18n.translate(error, scope: scope, default: nil)

  message || I18n.translate(error, scope: SCOPE, default: default)
end