lib/tolk/sync.rb in tolk-1.6.0.alpha1 vs lib/tolk/sync.rb in tolk-1.6.0
- old
+ new
@@ -15,10 +15,14 @@
filter_out_i18n_keys(translations.merge(read_primary_locale_file))
end
def read_primary_locale_file
primary_file = "#{self.locales_config_path}/#{self.primary_locale_name}.yml"
- File.exists?(primary_file) ? flat_hash(YAML::safe_load(IO.read(primary_file))[self.primary_locale_name]) : {}
+ if File.exists?(primary_file)
+ flat_hash(Tolk::YAML.load_file(primary_file)[self.primary_locale_name])
+ else
+ {}
+ end
end
def flat_hash(data, prefix = '', result = {})
data.each do |key, value|
current_prefix = prefix.present? ? "#{prefix}.#{key}" : key