Commit d0a3119d by 李福中

Add data type i18n

parent 88fb8ffc
......@@ -95,7 +95,7 @@ module RailsParam
end
return nil
rescue ArgumentError
raise InvalidParameterError, error_message_for(nil, "#{param}不是合法的:#{type}", options)
raise InvalidParameterError, error_message_for(nil, "#{options[:label] || param}不是合法的#{data_type_i18n(type)}", options)
end
end
......@@ -145,5 +145,19 @@ module RailsParam
end
end
def data_type_i18n(type)
{
Integer => '整数',
Float => '数字',
String => '字符串',
Date => '日期',
Time => '时间',
DateTime => '日期时间',
Array => '数组',
Hash => '哈希',
BigDecimal => '数字'
}
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment