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

Prerequisites

  • Project in Lokalise (you will need Project ID from project settings)

  • Read/write API token (generate one under your Personal profile)

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!

Did this answer your question?