Module I18n::Backend::Flatten
In: lib/active_support/vendor/i18n-0.4.1/i18n/backend/flatten.rb

This module contains several helpers to assist flattening translations. You may want to flatten translations for:

  1) speed up lookups, as in the Memoize backend;
  2) In case you want to store translations in a data store, as in ActiveRecord backend;

You can check both backends above for some examples. This module also keeps all links in a hash so they can be properly resolved when flattened.

Methods

Constants

SEPARATOR_ESCAPE_CHAR = "\001"
FLATTEN_SEPARATOR = "."

Public Class methods

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.

Public Instance methods

Flatten keys for nested Hashes by chaining up keys:

  >> { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"}.wind
  => { "a.b.c" => "d", "a.b.e" => "f", "a.g" => "h", "i" => "j" }

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.

Store flattened links.

Protected Instance methods

[Validate]