module I18n::Tasks::Translation
Public Instance Methods
translate_forest(forest, from:, backend: :google)
click to toggle source
@param [I18n::Tasks::Tree::Siblings] forest to translate to the locales of its root nodes @param [String] from locale @param [:deepl, :openai, :google, :yandex] backend @return [I18n::Tasks::Tree::Siblings] translated forest
# File lib/i18n/tasks/translation.rb, line 14 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) when :openai Translators::OpenAiTranslator.new(self).translate_forest(forest, from) when :yandex Translators::YandexTranslator.new(self).translate_forest(forest, from) else fail CommandError, "invalid backend: #{backend}" end end