module YamlLocalesJsonizer::Loader

Public Instance Methods

locales() click to toggle source
# File lib/yaml_locales_jsonizer/loader.rb, line 4
def locales
  locale_files.reduce({}) do |locales, file|
    langdata = YAML.load_file file

    langdata.each_pair do |lang, translations|
      locales[lang] ||= style.empty_locale
      style.add_to_locale locales[lang], translations
    end

    locales
  end
end

Private Instance Methods

locale_files() click to toggle source
# File lib/yaml_locales_jsonizer/loader.rb, line 19
def locale_files
  cfg = YamlLocalesJsonizer
  cfg.load_path.select do |f|
    cfg.only_files.find { |m| File.fnmatch?(m, f) || File.basename(f) == m }
  end
end
style() click to toggle source
# File lib/yaml_locales_jsonizer/loader.rb, line 26
def style
  YamlLocalesJsonizer::Styles::I18next
end