Commit dfaf83616cc8f32d2a2341fddcbb726eb597de39
1 parent
04962ef3
Exists in
master
and in
29 other branches
Fixed error messages
(ActionItem2904)
Showing
9 changed files
with
13 additions
and
13 deletions
Show diff stats
app/models/category.rb
| ... | ... | @@ -7,13 +7,13 @@ class Category < ActiveRecord::Base |
| 7 | 7 | :slug => 1, |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - validates_exclusion_of :slug, :in => [ 'index' ], :message => N_('%{fn} cannot be like that.').fix_i18n | |
| 10 | + validates_exclusion_of :slug, :in => [ 'index' ], :message => N_('{fn} cannot be like that.').fix_i18n | |
| 11 | 11 | validates_presence_of :name, :environment_id |
| 12 | - validates_uniqueness_of :slug,:scope => [ :environment_id, :parent_id ], :message => N_('%{fn} is already being used by another category.').fix_i18n | |
| 12 | + validates_uniqueness_of :slug,:scope => [ :environment_id, :parent_id ], :message => N_('{fn} is already being used by another category.').fix_i18n | |
| 13 | 13 | belongs_to :environment |
| 14 | 14 | |
| 15 | 15 | validates_inclusion_of :display_color, :in => [ 1, 2, 3, 4, nil ] |
| 16 | - validates_uniqueness_of :display_color, :scope => :environment_id, :if => (lambda { |cat| ! cat.display_color.nil? }), :message => N_('%{fn} was already assigned to another category.').fix_i18n | |
| 16 | + validates_uniqueness_of :display_color, :scope => :environment_id, :if => (lambda { |cat| ! cat.display_color.nil? }), :message => N_('{fn} was already assigned to another category.').fix_i18n | |
| 17 | 17 | |
| 18 | 18 | # Finds all top level categories for a given environment. |
| 19 | 19 | named_scope :top_level_for, lambda { |environment| | ... | ... |
app/models/comment.rb
| ... | ... | @@ -29,7 +29,7 @@ class Comment < ActiveRecord::Base |
| 29 | 29 | validates_presence_of :author_id, :if => (lambda { |rec| rec.name.blank? && rec.email.blank? }) |
| 30 | 30 | validates_each :name do |rec,attribute,value| |
| 31 | 31 | if rec.author_id && (!rec.name.blank? || !rec.email.blank?) |
| 32 | - rec.errors.add(:name, _('%{fn} can only be informed for unauthenticated authors').fix_i18n) | |
| 32 | + rec.errors.add(:name, _('{fn} can only be informed for unauthenticated authors').fix_i18n) | |
| 33 | 33 | end |
| 34 | 34 | end |
| 35 | 35 | ... | ... |
app/models/create_enterprise.rb
| ... | ... | @@ -40,12 +40,12 @@ class CreateEnterprise < Task |
| 40 | 40 | |
| 41 | 41 | if self.region && self.target |
| 42 | 42 | unless self.region.validators.include?(self.target) || self.target_type == "Environment" |
| 43 | - self.errors.add(:target, _('%{fn} is not a validator for the chosen region').fix_i18n) | |
| 43 | + self.errors.add(:target, _('{fn} is not a validator for the chosen region').fix_i18n) | |
| 44 | 44 | end |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | 47 | if self.status != Task::Status::CANCELLED && self.identifier && Profile.exists?(:identifier => self.identifier) |
| 48 | - self.errors.add(:identifier, _('%{fn} is already being as identifier by another enterprise, organization or person.').fix_i18n) | |
| 48 | + self.errors.add(:identifier, _('{fn} is already being as identifier by another enterprise, organization or person.').fix_i18n) | |
| 49 | 49 | end |
| 50 | 50 | end |
| 51 | 51 | ... | ... |
app/models/domain.rb
| ... | ... | @@ -10,14 +10,14 @@ class Domain < ActiveRecord::Base |
| 10 | 10 | |
| 11 | 11 | # <tt>name</tt> must be sequences of alphanumeric characters (a to z, |
| 12 | 12 | # 0 to 9), plus '_' or '-', separated by dots. Letters must be lowercase. |
| 13 | - validates_format_of :name, :with => /^([a-z0-9_-]+\.)+[a-z0-9_-]+$/, :message => N_('%{fn} must be composed of sequences of lowercase letters (a to z), numbers (0 to 9), "_" and "-", separated by dots.').fix_i18n | |
| 13 | + validates_format_of :name, :with => /^([a-z0-9_-]+\.)+[a-z0-9_-]+$/, :message => N_('{fn} must be composed of sequences of lowercase letters (a to z), numbers (0 to 9), "_" and "-", separated by dots.').fix_i18n | |
| 14 | 14 | |
| 15 | 15 | # checks validations that could not be expressed using Rails' predefined |
| 16 | 16 | # validations. In particular: |
| 17 | 17 | # * <tt>name</tt> must not start with 'www.' |
| 18 | 18 | def validate |
| 19 | 19 | if self.name =~ /^www\./ |
| 20 | - self.errors.add(:name, _('%{fn} must not start with www.').fix_i18n) | |
| 20 | + self.errors.add(:name, _('{fn} must not start with www.').fix_i18n) | |
| 21 | 21 | end |
| 22 | 22 | end |
| 23 | 23 | ... | ... |
app/models/event.rb
| ... | ... | @@ -25,7 +25,7 @@ class Event < Article |
| 25 | 25 | |
| 26 | 26 | validates_each :start_date do |event,field,value| |
| 27 | 27 | if event.end_date && event.start_date && event.start_date > event.end_date |
| 28 | - event.errors.add(:start_date, _('%{fn} cannot come before end date.').fix_i18n) | |
| 28 | + event.errors.add(:start_date, _('{fn} cannot come before end date.').fix_i18n) | |
| 29 | 29 | end |
| 30 | 30 | end |
| 31 | 31 | ... | ... |
app/models/image.rb
| ... | ... | @@ -17,7 +17,7 @@ class Image < ActiveRecord::Base |
| 17 | 17 | :icon => '20x20!' }, |
| 18 | 18 | :max_size => 5.megabytes # remember to update validate message below |
| 19 | 19 | |
| 20 | - validates_attachment :size => N_("%{fn} of uploaded file was larger than the maximum size of 5.0 MB").fix_i18n | |
| 20 | + validates_attachment :size => N_("{fn} of uploaded file was larger than the maximum size of 5.0 MB").fix_i18n | |
| 21 | 21 | |
| 22 | 22 | delay_attachment_fu_thumbnails |
| 23 | 23 | ... | ... |
app/models/person.rb
| ... | ... | @@ -240,7 +240,7 @@ class Person < Profile |
| 240 | 240 | |
| 241 | 241 | validates_each :email, :on => :update do |record,attr,value| |
| 242 | 242 | if User.find(:first, :conditions => ['email = ? and id != ? and environment_id = ?', value, record.user.id, record.environment.id]) |
| 243 | - record.errors.add(attr, _('%{fn} is already used by other user').fix_i18n) | |
| 243 | + record.errors.add(attr, _('{fn} is already used by other user').fix_i18n) | |
| 244 | 244 | end |
| 245 | 245 | end |
| 246 | 246 | ... | ... |
app/models/uploaded_file.rb
| ... | ... | @@ -54,7 +54,7 @@ class UploadedFile < Article |
| 54 | 54 | :thumbnail_class => Thumbnail, |
| 55 | 55 | :max_size => 5.megabytes # remember to update validate message below |
| 56 | 56 | |
| 57 | - validates_attachment :size => N_("%{fn} of uploaded file was larger than the maximum size of 5.0 MB").fix_i18n | |
| 57 | + validates_attachment :size => N_("{fn} of uploaded file was larger than the maximum size of 5.0 MB").fix_i18n | |
| 58 | 58 | |
| 59 | 59 | delay_attachment_fu_thumbnails |
| 60 | 60 | ... | ... |
app/models/user.rb
| ... | ... | @@ -114,7 +114,7 @@ class User < ActiveRecord::Base |
| 114 | 114 | before_save :encrypt_password |
| 115 | 115 | validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?}) |
| 116 | 116 | |
| 117 | - validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('%{fn} must be checked in order to signup.').fix_i18n | |
| 117 | + validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('{fn} must be checked in order to signup.').fix_i18n | |
| 118 | 118 | |
| 119 | 119 | # Authenticates a user by their login name or email and unencrypted password. Returns the user or nil. |
| 120 | 120 | def self.authenticate(login, password, environment = nil) | ... | ... |