From 40a8130bc5f00f0d77b152e75484f175d70cabdd Mon Sep 17 00:00:00 2001 From: printercu Date: Wed, 7 Aug 2013 12:33:28 +0400 Subject: ActionController#translate supports symbols Made it similar to views helper. --- actionpack/lib/abstract_controller/translation.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/abstract_controller') 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 # I18n.translate("people.index.foo"). 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 -- cgit v1.2.3