Please note that this article covers a solution for plain Ruby. You might also be interested in our Ruby on Rails integration.

Prerequisites

Exchanging translation files

If you are building a plain Ruby application and would like to exchange translation files with Lokalise, you can take advantage of a special library to manage translation files (lokalise_manager gem) which allows to run the import/export task programmatically from any Ruby script.

Here's an example:

require "#{Rails.root}/config/lokalise_rails.rb"

importer = LokaliseManager.importer({api_token: '1234abc', project_id: '123.abc'}, LokaliseRails::GlobalConfig)
importer.import!

# OR

exporter = LokaliseManager.exporter({api_token: '1234abc', project_id: '123.abc'}, LokaliseRails::GlobalConfig)
exporter.export!

Please find more information on all the available options and other features in the official repo.

Did this answer your question?