]> git.openstreetmap.org Git - rails.git/blobdiff - app/validators/invalid_chars_validator.rb
Converted invalid_chars validator to use locale
[rails.git] / app / validators / invalid_chars_validator.rb
index 3860c95a3661192daadda41339f3306e48fc7709..f21f5a7cdb539aea4d432cd352f80cddfc8d54f5 100644 (file)
@@ -2,6 +2,6 @@ class InvalidCharsValidator < ActiveModel::EachValidator
   INVALID_CHARS = "\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff".freeze
 
   def validate_each(record, attribute, value)
   INVALID_CHARS = "\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff".freeze
 
   def validate_each(record, attribute, value)
-    record.errors[attribute] << (options[:message] || "contains invalid chars") if value =~ /[#{INVALID_CHARS}]/
+    record.errors[attribute] << (options[:message] || I18n.t("validations.invalid_chars")) if value =~ /[#{INVALID_CHARS}]/
   end
 end
   end
 end