instance method resolve

Ruby on Rails 2.3.18

Since v2.3.18 Last seen in v2.3.18

Signature

resolve(locale, object, subject, options = nil)

Resolves a translation. If the given subject is a Symbol, it will be translated with the given options. If it is a Proc then it will be evaluated. All other subjects will be returned directly.

Parameters

locale req
object req
subject req
options opt = nil
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb, line 116
        def resolve(locale, object, subject, options = nil)
          return subject if options[:resolve] == false
          case subject
          when Symbol
            I18n.translate(subject, (options || {}).merge(:locale => locale, :raise => true))
          when Proc
            date_or_time = options.delete(:object) || object
            resolve(locale, object, subject.call(date_or_time, options), options = {})
          else
            subject
          end
        rescue MissingTranslationData
          nil
        end

Defined in activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb line 116 · View on GitHub · Improve this page · Find usages on GitHub

Defined in I18n::Backend::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close