Module: I18n::Tasks::Translation
- Included in:
- BaseTask
- Defined in:
- lib/i18n/tasks/translation.rb
Instance Method Summary collapse
Instance Method Details
#translate_forest(forest, from:, backend: :google) ⇒ I18n::Tasks::Tree::Siblings
Returns translated forest.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |