Class: I18n::Tasks::Translators::DeeplTranslator

Inherits:
BaseTranslator show all
Defined in:
lib/i18n/tasks/translators/deepl_translator.rb

Constant Summary collapse

BATCH_SIZE =

max allowed texts per request

50
SPECIFIC_TARGETS =

those languages must be specified with their sub-kind e.g en-us

%w[en pt].freeze

Constants included from Logging

Logging::MUTEX, Logging::PROGRAM_NAME

Instance Method Summary collapse

Methods inherited from BaseTranslator

#translate_forest

Methods included from Logging

log_error, log_stderr, log_verbose, log_warn, program_name, warn_deprecated

Constructor Details

#initializeDeeplTranslator

Returns a new instance of DeeplTranslator.



12
13
14
15
16
17
18
19
20
# File 'lib/i18n/tasks/translators/deepl_translator.rb', line 12

def initialize(*)
  begin
    require 'deepl'
  rescue LoadError
    raise ::I18n::Tasks::CommandError, "Add gem 'deepl-rb' to your Gemfile to use this command"
  end
  super
  configure_api_key!
end