module I18n::Backend::Flatten
def self.normalize_flat_keys(locale, key, scope, separator)
and creates way less objects than the one at I18n.normalize_keys.
normalize_keys the flatten way. This method is significantly faster
def self.normalize_flat_keys(locale, key, scope, separator) keys = [scope, key] keys.flatten! keys.compact! separator ||= I18n.default_separator if separator != FLATTEN_SEPARATOR from_str = "#{FLATTEN_SEPARATOR}#{separator}" to_str = "#{SEPARATOR_ESCAPE_CHAR}#{FLATTEN_SEPARATOR}" keys.map! { |k| k.to_s.tr from_str, to_str } end keys.join(".") end