instance method flatten_translations

Ruby on Rails 2.3.18

Since v2.3.18 Last seen in v2.3.18

Signature

flatten_translations(locale, data, escape, subtree)

Receives a hash of translations (where the key is a locale and the value is another hash) and return a hash with all translations flattened.

Nested hashes are included in the flattened hash just if subtree is true and Symbols are automatically stored as links.

Parameters

locale req
data req
escape req
subtree req
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/flatten.rb, line 69
      def flatten_translations(locale, data, escape, subtree)
        hash = {}
        flatten_keys(data, escape) do |key, value|
          if value.is_a?(Hash)
            hash[key] = value if subtree
          else
            store_link(locale, key, value) if value.is_a?(Symbol)
            hash[key] = value
          end
        end
        hash
      end

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

Defined in I18n::Backend::Flatten

Type at least 2 characters to search.

↑↓ navigate · open · esc close