Module: WebTranslateIt

Defined in:
lib/web_translate_it.rb,
lib/web_translate_it/term.rb,
lib/web_translate_it/util.rb,
lib/web_translate_it/string.rb,
lib/web_translate_it/project.rb,
lib/web_translate_it/auto_fetch.rb,
lib/web_translate_it/connection.rb,
lib/web_translate_it/translation.rb,
lib/web_translate_it/command_line.rb,
lib/web_translate_it/configuration.rb,
lib/web_translate_it/term_translation.rb,
lib/web_translate_it/translation_file.rb

Defined Under Namespace

Classes: AutoFetch, CommandLine, Configuration, Connection, Project, String, Term, TermTranslation, Translation, TranslationFile, Util

Class Method Summary collapse

Class Method Details

.fetch_translationsObject

rubocop:todo Metrics/AbcSize



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/web_translate_it.rb', line 31

def self.fetch_translations # rubocop:todo Metrics/AbcSize
  config = Configuration.new
  locale = I18n.locale.to_s
  return if config.ignore_locales.include?(locale)

  config.logger&.debug { "   Fetching #{locale} language file(s) from WebTranslateIt" }
  WebTranslateIt::Connection.new(config.api_key) do |http|
    config.files.find_all { |file| file.locale.in?([locale, I18n.locale]) }.each do |file|
      file.fetch(http)
    end
  end
end