class I18n::Loader::YAML
- I18n::Loader::YAML
- I18n::Loader::Base
- Reference
- Object
Overview
The YAML translations loader.
This loader implementation allows to load translations from YAML files (.yaml
or .yml
files). It must be
initialized from a given path and it will recursively try to load all the YAML files that are available under the
targetted directory:
I18n.config.loaders << I18n::Loader::YAML.new("config/locales")
This loader also allows to embed the raw translations that are available under the targetted directory inside the
compiled binary through the use of the #embed
macro:
I18n.config.loaders << I18n::Loader::YAML.embed("config/locales")
Defined in:
i18n/loader/yaml.crConstructors
Class Method Summary
-
.normalize_raw_translations(raw_translations : Array(String))
Converts an array of YAML strings to a valid translations hash.
Macro Summary
Instance Method Summary
-
#load : TranslationsHash
Loads the translations targetted by the current loader.
- #path : String?
- #preloaded_translations : Hash(String, I18n::TranslationsHashValues)?
Instance methods inherited from class I18n::Loader::Base
load : TranslationsHash
load
Macros inherited from class I18n::Loader::Base
embed(path)
embed
Constructor Detail
Class Method Detail
def self.normalize_raw_translations(raw_translations : Array(String))
#
Converts an array of YAML strings to a valid translations hash.
Macro Detail
Instance Method Detail
def load : TranslationsHash
#
Description copied from class I18n::Loader::Base
Loads the translations targetted by the current loader.