lib/i18n/tasks/translators/deepl_translator.rb in i18n-tasks-0.9.31 vs lib/i18n/tasks/translators/deepl_translator.rb in i18n-tasks-0.9.32
- old
+ new
@@ -15,10 +15,15 @@
end
protected
def translate_values(list, from:, to:, **options)
- DeepL.translate(list, to_deepl_compatible_locale(from), to_deepl_compatible_locale(to), options).map(&:text)
+ result = DeepL.translate(list, to_deepl_compatible_locale(from), to_deepl_compatible_locale(to), options).map(&:text)
+ if result.is_a?(DeepL::Resources::Text)
+ result.text
+ else
+ result.map(&:text)
+ end
end
def options_for_translate_values(**options)
{ ignore_tags: %w[i18n] }.merge(options)
end