26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/i18n_country_translations/railtie.rb', line 26
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
|