Class: Fastlane::Helper::BatchTranslationProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/translate/helper/batch_translation_processor.rb

Class Method Summary collapse

Class Method Details

.process_batch(batch, source_lang, target_lang, formality, progress) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/translate/helper/batch_translation_processor.rb', line 11

def self.process_batch(batch, source_lang, target_lang, formality, progress)
  # Prepare batch for DeepL API
  texts_to_translate = batch.map { |_, data| data['source_text'] }

  # Build translation options
  translation_options = build_translation_options(formality, batch)

  # Call DeepL API
  translations = DeepL.translate(texts_to_translate, source_lang, target_lang, translation_options)

  # Process and save translations
  save_batch_translations(batch, translations, progress)
end