Class: LokaliseManager::TaskDefinitions::Exporter

Inherits:
Base
  • Object
show all
Defined in:
lib/lokalise_manager/task_definitions/exporter.rb

Overview

Class to handle exporting translation files from a local project to Lokalise.

Constant Summary collapse

MAX_THREADS =

Maximum number of concurrent uploads to avoid exceeding Lokalise API rate limits.

6

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#api_client, #initialize, #reset_api_client!

Constructor Details

This class inherits a constructor from LokaliseManager::TaskDefinitions::Base

Instance Method Details

#export!Array

Exports translation files to Lokalise and handles any necessary concurrency and error checking.

Returns:

  • (Array)

    An array of process statuses for each file uploaded.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lokalise_manager/task_definitions/exporter.rb', line 15

def export!
  check_options_errors!

  queued_processes = all_files.each_slice(MAX_THREADS).flat_map do |files_group|
    parallel_upload(files_group).tap do |threads|
      threads.each { |thr| raise_on_fail(thr) if config.raise_on_export_fail }
    end
  end

  print_completion_message unless config.silent_mode

  queued_processes
end