instance method
translate
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18Signature
translate(locale, key, options = {})
No documentation comment.
Parameters
-
localereq -
keyreq -
optionsopt = {}
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/chain.rb, line 40
def translate(locale, key, options = {})
return key.map { |k| translate(locale, k, options) } if key.is_a?(Array)
default = options.delete(:default)
namespace = {}
backends.each do |backend|
begin
options.update(:default => default) if default and backend == backends.last
translation = backend.translate(locale, key, options)
if namespace_lookup?(translation, options)
namespace.update(translation)
elsif !translation.nil?
return translation
end
rescue MissingTranslationData
end
end
return namespace unless namespace.empty?
raise(I18n::MissingTranslationData.new(locale, key, options))
end
Defined in activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/chain.rb line 40
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in I18n::Backend::Chain