class method self.normalize_flat_keys

Ruby on Rails 2.3.18

Since v2.3.18 Last seen in v2.3.18

Signature

self.normalize_flat_keys(locale, key, scope, separator)

normalize_keys the flatten way. This method is significantly faster and creates way less objects than the one at I18n.normalize_keys. It also handles escaping the translation keys.

Parameters

locale req
key req
scope req
separator req
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/flatten.rb, line 18
      def self.normalize_flat_keys(locale, key, scope, separator)
        keys = [scope, key].flatten.compact
        separator ||= I18n.default_separator

        if separator != FLATTEN_SEPARATOR
          keys.map! do |k|
            k.to_s.tr("#{FLATTEN_SEPARATOR}#{separator}",
              "#{SEPARATOR_ESCAPE_CHAR}#{FLATTEN_SEPARATOR}")
          end
        end

        keys.join(".")
      end

Defined in activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/flatten.rb line 18 · 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