instance method merge_translations

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.2.3

Signature

merge_translations(locale, data)

Deep merges the given translations hash with the existing translations for the given locale

Parameters

locale req
data req
Source
# File activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb, line 196
        def merge_translations(locale, data)
          locale = locale.to_sym
          translations[locale] ||= {}
          data = deep_symbolize_keys(data)

          # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
          merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
          translations[locale].merge!(data, &merger)
        end

Defined in activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb line 196 · 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