1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Review #translate docs [ci skip]

This commit is contained in:
Carlos Antonio da Silva 2013-01-20 22:47:41 -02:00
parent 37d15d4e1b
commit 2061c98b42

View file

@ -1,14 +1,13 @@
module AbstractController module AbstractController
module Translation module Translation
# Delegates to <tt>I18n#translate</tt> but also performs one additional function. # Delegates to <tt>I18n.translate</tt>. Also aliased as <tt>t</tt>.
# #
# It'll scope the key by the current action if the key starts # When the given key starts with a period, it will be scoped by the current
# with a period. So if you call <tt>translate(".foo")</tt> from the # controller and action. So if you call <tt>translate(".foo")</tt> from
# <tt>PeopleController#index</tt> action, you'll actually be calling # <tt>PeopleController#index</tt>, it will convert the call to
# <tt>I18n.translate("people.index.foo")</tt>. This makes it less repetitive # <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 # to translate many keys within the same controller / action and gives you a
# for scoping them consistently. If you don't prepend the key with a period, # simple framework for scoping them consistently.
# nothing is converted.
def translate(*args) def translate(*args)
key = args.first key = args.first
if key.is_a?(String) && (key[0] == '.') if key.is_a?(String) && (key[0] == '.')
@ -20,7 +19,7 @@ module AbstractController
end end
alias :t :translate alias :t :translate
# Delegates to <tt>I18n.localize</tt> with no additional functionality. # Delegates to <tt>I18n.localize</tt>. Also aliased as <tt>l</tt>.
def localize(*args) def localize(*args)
I18n.localize(*args) I18n.localize(*args)
end end