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/translation_file.rb,
lib/web_translate_it/term_translation.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


20
21
22
23
24
25
26
27
28
29
30
# File 'lib/web_translate_it.rb', line 20

def self.fetch_translations
  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" } if config.logger
  WebTranslateIt::Connection.new(config.api_key) do |http|
    config.files.find_all{ |file| file.locale.in?([locale, I18n.locale]) }.each do |file|
      response = file.fetch(http)
    end
  end
end