removed translation of error messages inside ActiveRecord module

git-svn-id: http://redmine.rubyforge.org/svn/trunk@222 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-02-03 12:42:06 +00:00
parent b5e80bf90f
commit 4a988b0f92
1 changed files with 23 additions and 23 deletions

View File

@ -130,29 +130,29 @@ module ActiveRecord #:nodoc:
include GLoc include GLoc
end end
class Errors # class Errors
include GLoc # include GLoc
alias :add_without_gloc :add # alias :add_without_gloc :add
# The GLoc version of this method provides two extra features # # The GLoc version of this method provides two extra features
# * If <tt>msg</tt> is a string, it will be considered a GLoc string key. # # * If <tt>msg</tt> is a string, it will be considered a GLoc string key.
# * If <tt>msg</tt> is an array, the first element will be considered # # * If <tt>msg</tt> is an array, the first element will be considered
# the string and the remaining elements will be considered arguments for the # # the string and the remaining elements will be considered arguments for the
# string. Eg. <tt>['Hi %s.','John']</tt> # # string. Eg. <tt>['Hi %s.','John']</tt>
def add(attribute, msg= @@default_error_messages[:invalid]) # def add(attribute, msg= @@default_error_messages[:invalid])
if msg.is_a?(Array) # if msg.is_a?(Array)
args= msg.clone # args= msg.clone
msg= args.shift # msg= args.shift
args= nil if args.empty? # args= nil if args.empty?
end # end
msg= ltry(msg) # msg= ltry(msg)
msg= msg % args unless args.nil? # msg= msg % args unless args.nil?
add_without_gloc(attribute, msg) # add_without_gloc(attribute, msg)
end # end
# Inherits the current language from the base record. # # Inherits the current language from the base record.
def current_language # def current_language
@base.current_language # @base.current_language
end # end
end # end
module Validations #:nodoc: module Validations #:nodoc:
module ClassMethods module ClassMethods