class Icapps::Translations::Import::Base

Public Class Methods

config() click to toggle source
# File lib/icapps/translations/import/base.rb, line 24
def config
  ::Icapps::Translations.config
end
fetch_languages() click to toggle source
# File lib/icapps/translations/import/base.rb, line 28
def fetch_languages
  ::Icapps::Translations::Http.authenticated_response('languages.json', true)
end
import() click to toggle source
# File lib/icapps/translations/import/base.rb, line 10
def import
  puts "[VERBOSE] Importing translations from project with key #{options.project_key}".colorize(:white) if options[:verbose]

  languages_json = fetch_languages
  puts "[VERBOSE] There are currently #{languages_json.count} language(s) for this project.".colorize(:white) if options[:verbose]

  languages_json.each { |language| fetch_language_file language }
  puts '[MESSAGE] Finished importing translation.'.colorize(:green)
end
options() click to toggle source
# File lib/icapps/translations/import/base.rb, line 20
def options
  ::Icapps::Translations.options
end
write_to_file(content, files, language) click to toggle source
# File lib/icapps/translations/import/base.rb, line 32
def write_to_file(content, files, language)
  File.open(files.first, 'w+') { |file| file.puts content }
  puts "[VERBOSE] Written #{language['short_name']} translations to #{files.first}.".colorize(:green) if options[:verbose]
end