aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorprintercu <printercu@gmail.com>2013-08-07 12:33:28 +0400
committerMax Melentiev <melentievm@gmail.com>2013-09-25 16:23:28 +0400
commit40a8130bc5f00f0d77b152e75484f175d70cabdd (patch)
tree4b75d61368faa80f10d3849dfc63f3fa55551210 /actionpack/lib
parent69c5e010dcff0545fb2f38672e28894f230b1338 (diff)
downloadrails-40a8130bc5f00f0d77b152e75484f175d70cabdd.tar.gz
rails-40a8130bc5f00f0d77b152e75484f175d70cabdd.tar.bz2
rails-40a8130bc5f00f0d77b152e75484f175d70cabdd.zip
ActionController#translate supports symbols
Made it similar to views helper.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/abstract_controller/translation.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/actionpack/lib/abstract_controller/translation.rb b/actionpack/lib/abstract_controller/translation.rb
index 02028d8e05..ea2551cb70 100644
--- a/actionpack/lib/abstract_controller/translation.rb
+++ b/actionpack/lib/abstract_controller/translation.rb
@@ -8,14 +8,11 @@ module AbstractController
# <tt>I18n.translate("people.index.foo")</tt>. This makes it less repetitive
# to translate many keys within the same controller / action and gives you a
# simple framework for scoping them consistently.
- def translate(*args)
- key = args.first
- if key.is_a?(String) && (key[0] == '.')
+ def translate(key, options = {})
+ if key.to_s.first == '.'
key = "#{ controller_path.tr('/', '.') }.#{ action_name }#{ key }"
- args[0] = key
end
-
- I18n.translate(*args)
+ I18n.translate(key, options)
end
alias :t :translate