instance method lookup

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.2.3

Signature

lookup(locale, key, scope = [])

Looks up a translation from the translations hash. Returns nil if eiher key is nil, or locale, scope or key do not exist as a key in the nested translations hash. Splits keys or scopes containing dots into multiple keys, i.e. currency.format is regarded the same as %w(currency format).

Parameters

locale req
key req
scope opt = []
Source
# File activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb, line 92
        def lookup(locale, key, scope = [])
          return unless key
          init_translations unless initialized?
          keys = I18n.send(:normalize_translation_keys, locale, key, scope)
          keys.inject(translations) do |result, k|
            if (x = result[k.to_sym]).nil?
              return nil
            else
              x
            end
          end
        end

Defined in activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb line 92 · View on GitHub · Improve this page · Find usages on GitHub

Defined in I18n::Backend::Simple

Type at least 2 characters to search.

↑↓ navigate · open · esc close