instance method
default
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3Signature
default(locale, default, options = {})
Evaluates a default translation. If the given default is a String it is used literally. If it is a Symbol it will be translated with the given options. If it is an Array the first translation yielded will be returned.
I.e., default(locale, [:foo, 'default']) will return default if translate(locale, :foo) does not yield a result.
Parameters
-
localereq -
defaultreq -
optionsopt = {}
Source
# File activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb, line 112
def default(locale, default, options = {})
case default
when String then default
when Symbol then translate locale, default, options
when Array then default.each do |obj|
result = default(locale, obj, options.dup) and return result
end and nil
end
rescue MissingTranslationData
nil
end
Defined in activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb line 112
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in I18n::Backend::Simple