diff --git a/app/models/stripped_length_validator.rb b/app/models/stripped_length_validator.rb index 2342eab71..b84ff0b00 100644 --- a/app/models/stripped_length_validator.rb +++ b/app/models/stripped_length_validator.rb @@ -3,12 +3,12 @@ class StrippedLengthValidator < ActiveModel::EachValidator unless value.nil? stripped_length = value.strip.length range = options[:in] - record.errors.add attribute, (options[:message] || "is too short (minimum is #{range.begin}).") unless + record.errors.add attribute, (options[:message] || I18n.t('errors.messages.too_short', count: range.begin)) unless stripped_length >= range.begin - record.errors.add attribute, (options[:message] || "is too long (maximum is #{range.end}).") unless + record.errors.add attribute, (options[:message] || I18n.t('errors.messages.too_long', count: range.end)) unless stripped_length <= range.end else - record.errors.add attribute, (options[:message] || "is required.") + record.errors.add attribute, (options[:message] || I18n.t('errors.messages.blank')) end end end