Module: LokaliseManager

Defined in:
lib/lokalise_manager.rb,
lib/lokalise_manager/error.rb,
lib/lokalise_manager/version.rb,
lib/lokalise_manager/global_config.rb,
lib/lokalise_manager/utils/hash_utils.rb,
lib/lokalise_manager/task_definitions/base.rb,
lib/lokalise_manager/task_definitions/exporter.rb,
lib/lokalise_manager/task_definitions/importer.rb

Overview

The LokaliseManager module provides a high-level interface for importing and exporting translation files between a Ruby project and the Lokalise TMS.

This module simplifies interactions with the Lokalise API by exposing two factory methods:

  • importer → Instantiates an importer for fetching translations from Lokalise.
  • exporter → Instantiates an exporter for uploading translations to Lokalise.

Example Usage:

importer = LokaliseManager.importer(api_token: '1234abc', project_id: '123.abc')
exporter = LokaliseManager.exporter(api_token: '1234abc', project_id: '123.abc')

importer.import!
exporter.export!

Defined Under Namespace

Modules: TaskDefinitions, Utils Classes: Error, GlobalConfig

Constant Summary collapse

VERSION =
'8.0.0'

Class Method Summary collapse

Class Method Details

.exporter(custom_opts = {}, global_config = LokaliseManager::GlobalConfig) ⇒ LokaliseManager::TaskDefinitions::Exporter

Instantiates an exporter for uploading translation files to Lokalise.

Example:

exporter = LokaliseManager.exporter(api_token: 'xyz', project_id: '456.abc')
exporter.export!

Parameters:

  • custom_opts (Hash) (defaults to: {})

    Custom options for the exporter (e.g., api_token, project_id).

  • global_config (Object) (defaults to: LokaliseManager::GlobalConfig)

    The global configuration object (defaults to LokaliseManager::GlobalConfig).

Returns:



55
56
57
# File 'lib/lokalise_manager.rb', line 55

def exporter(custom_opts = {}, global_config = LokaliseManager::GlobalConfig)
  TaskDefinitions::Exporter.new custom_opts, global_config
end

.importer(custom_opts = {}, global_config = LokaliseManager::GlobalConfig) ⇒ LokaliseManager::TaskDefinitions::Importer

Instantiates an importer for retrieving translation files from Lokalise.

Example:

importer = LokaliseManager.importer(api_token: 'xyz', project_id: '456.abc')
importer.import!

Parameters:

  • custom_opts (Hash) (defaults to: {})

    Custom options for the importer (e.g., api_token, project_id).

  • global_config (Object) (defaults to: LokaliseManager::GlobalConfig)

    The global configuration object (defaults to LokaliseManager::GlobalConfig).

Returns:



39
40
41
# File 'lib/lokalise_manager.rb', line 39

def importer(custom_opts = {}, global_config = LokaliseManager::GlobalConfig)
  TaskDefinitions::Importer.new custom_opts, global_config
end