Sha256: f1ee8c8f23a199839ae2b051b46e08ec67f7c1cf82aee1ac18c33d78ff779e17

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

require 'i18n/tasks/translators/deepl_translator.rb'
require 'i18n/tasks/translators/google_translator.rb'

module I18n::Tasks
  module Translation
    # @param [I18n::Tasks::Tree::Siblings] forest to translate to the locales of its root nodes
    # @param [String] from locale
    # @param [:deepl, :google] backend
    # @return [I18n::Tasks::Tree::Siblings] translated forest
    def translate_forest(forest, from:, backend: :google)
      case backend
      when :deepl
        Translators::DeeplTranslator.new(self).translate_forest(forest, from)
      when :google
        Translators::GoogleTranslator.new(self).translate_forest(forest, from)
      else
        fail CommandError, "invalid backend: #{backend}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
i18n-tasks-0.9.30 lib/i18n/tasks/translation.rb
i18n-tasks-0.9.29 lib/i18n/tasks/translation.rb
i18n-tasks-0.9.28 lib/i18n/tasks/translation.rb
i18n-tasks-0.9.27 lib/i18n/tasks/translation.rb
i18n-tasks-0.9.26 lib/i18n/tasks/translation.rb
i18n-tasks-0.9.25 lib/i18n/tasks/translation.rb
i18n-tasks-0.9.24 lib/i18n/tasks/translation.rb