diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-07 01:04:25 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-07 15:31:49 +0100 |
commit | 190ce3ab37966957997cd18772d1260bf121c2e0 (patch) | |
tree | 55598ff271dea3c93b54823f9f5f2ec96b9cfef2 /activemodel/lib | |
parent | a323b83acfe6e02812ec3b7b4ce912b07c85220e (diff) | |
download | rails-190ce3ab37966957997cd18772d1260bf121c2e0.tar.gz rails-190ce3ab37966957997cd18772d1260bf121c2e0.tar.bz2 rails-190ce3ab37966957997cd18772d1260bf121c2e0.zip |
Errors messages are now moved from :activerecord.errors to simply :errors on I18n yml files.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 5 | ||||
-rw-r--r-- | activemodel/lib/active_model/locale/en.yml | 49 |
2 files changed, 26 insertions, 28 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index abc084a74b..0b6c75c46e 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -105,8 +105,7 @@ module ActiveModel else attr_name = attribute.to_s.gsub('.', '_').humanize attr_name = @base.class.human_attribute_name(attribute, :default => attr_name) - options = { :default => "{{attribute}} {{message}}", :attribute => attr_name, - :scope => @base.class.i18n_scope } + options = { :default => "{{attribute}} {{message}}", :attribute => attr_name } messages.each do |m| full_messages << I18n.t(:"errors.format", options.merge(:message => m)) @@ -153,7 +152,7 @@ module ActiveModel :model => @base.class.model_name.human, :attribute => @base.class.human_attribute_name(attribute), :value => value, - :scope => [@base.class.i18n_scope, :errors] + :scope => [:errors] }.merge(options) I18n.translate(key, options) diff --git a/activemodel/lib/active_model/locale/en.yml b/activemodel/lib/active_model/locale/en.yml index 1cdb897f13..ea58021767 100644 --- a/activemodel/lib/active_model/locale/en.yml +++ b/activemodel/lib/active_model/locale/en.yml @@ -1,27 +1,26 @@ en: - activemodel: - errors: - # model.errors.full_messages format. - format: "{{attribute}} {{message}}" + errors: + # The default format use in full error messages. + format: "{{attribute}} {{message}}" - # The values :model, :attribute and :value are always available for interpolation - # The value :count is available when applicable. Can be used for pluralization. - messages: - inclusion: "is not included in the list" - exclusion: "is reserved" - invalid: "is invalid" - confirmation: "doesn't match confirmation" - accepted: "must be accepted" - empty: "can't be empty" - blank: "can't be blank" - too_long: "is too long (maximum is {{count}} characters)" - too_short: "is too short (minimum is {{count}} characters)" - wrong_length: "is the wrong length (should be {{count}} characters)" - not_a_number: "is not a number" - greater_than: "must be greater than {{count}}" - greater_than_or_equal_to: "must be greater than or equal to {{count}}" - equal_to: "must be equal to {{count}}" - less_than: "must be less than {{count}}" - less_than_or_equal_to: "must be less than or equal to {{count}}" - odd: "must be odd" - even: "must be even" + # The values :model, :attribute and :value are always available for interpolation + # The value :count is available when applicable. Can be used for pluralization. + messages: + inclusion: "is not included in the list" + exclusion: "is reserved" + invalid: "is invalid" + confirmation: "doesn't match confirmation" + accepted: "must be accepted" + empty: "can't be empty" + blank: "can't be blank" + too_long: "is too long (maximum is {{count}} characters)" + too_short: "is too short (minimum is {{count}} characters)" + wrong_length: "is the wrong length (should be {{count}} characters)" + not_a_number: "is not a number" + greater_than: "must be greater than {{count}}" + greater_than_or_equal_to: "must be greater than or equal to {{count}}" + equal_to: "must be equal to {{count}}" + less_than: "must be less than {{count}}" + less_than_or_equal_to: "must be less than or equal to {{count}}" + odd: "must be odd" + even: "must be even" |