Method: Tolk::Import#read_locale_file

Defined in:
lib/tolk/import.rb

#read_locale_fileObject



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/tolk/import.rb', line 50

def read_locale_file
  locale_file = "#{self.locales_config_path}/#{self.name}.yml"
  raise "Locale file #{locale_file} does not exists" unless File.exist?(locale_file)

  puts "[INFO] Reading #{locale_file} for locale #{self.name}"
  begin
    self.class.flat_hash(Tolk::YAML.load_file(locale_file)[self.name])
  rescue
    puts "[ERROR] File #{locale_file} expected to declare #{self.name} locale, but it does not. Skipping this file."
    nil
  end

end