15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/i18n_country_translations/railtie.rb', line 15
def self.load_translations(locales = nil)
data_dir = I18nCountryTranslationsData.data_dir
locales = locales.map(&:to_sym) if locales.present?
Dir[File.join(data_dir, "*.json")].each do |file|
locale = File.basename(file, ".json").to_sym
next if locales.present? && !locales.include?(locale)
translations = JSON.parse(File.read(file))
I18n.backend.store_translations(locale, countries: translations)
end
end
|