aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/translation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/abstract_controller/translation.rb')
-rw-r--r--actionpack/lib/abstract_controller/translation.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/translation.rb b/actionpack/lib/abstract_controller/translation.rb
index 6d68cf4944..b6c484d188 100644
--- a/actionpack/lib/abstract_controller/translation.rb
+++ b/actionpack/lib/abstract_controller/translation.rb
@@ -1,6 +1,12 @@
module AbstractController
module Translation
def translate(*args)
+ key = args.first
+ if key.is_a?(String) && (key[0] == '.')
+ key = "#{ controller_path.gsub('/', '.') }.#{ action_name }#{ key }"
+ args[0] = key
+ end
+
I18n.translate(*args)
end
alias :t :translate
@@ -10,4 +16,4 @@ module AbstractController
end
alias :l :localize
end
-end \ No newline at end of file
+end