7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/num2words/i18n.rb', line 7
def self.load!
locales_path = File.expand_path("../../config/locales/*.yml", __dir__)
files = Dir[locales_path]
if files.empty?
raise "Num2words: не найдены файлы локалей в #{locales_path}"
end
I18n.load_path += files
I18n.available_locales = files.map { |file| File.basename(file, ".*") }.map(&:to_sym)
I18n.default_locale = :ru
I18n.enforce_available_locales = true
I18n.available_locales.each do |loc|
unless I18n.exists?("num2words.ones_masc", locale: loc)
raise "Num2words: отсутствуют ключи для локали #{loc} в locales/#{loc}.yml"
end
end
end
|