Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bodrovis authored May 11, 2023
1 parent c1cccd1 commit 2d8b0d3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ importer.import!
exporter.export!
```

### Example: Multiple translation paths

Creating custom import/export script can come in really handy if you have a non-standard setup, for instance, your translation files are stored in multiple directories (not only in the default `./config/locales`. To overcome this problem, create a custom Rake task and provide as many importers/exporters as needed:

```ruby
require 'rake'
require 'lokalise_rails'
require "#{LokaliseRails::Utils.root}/config/lokalise_rails"

namespace :lokalise_custom do
task :export do
# importing from the default directory (./config/locales/)
exporter = LokaliseManager.exporter({}, LokaliseRails::GlobalConfig)
exporter.export!

# importing from the custom directory
exporter = LokaliseManager.exporter({locales_path: "#{Rails.root}/config/custom_locales"}, LokaliseRails::GlobalConfig)
exporter.export!
rescue StandardError => e
abort e.inspect
end
end
```

## Configuration

Options are specified in the `config/lokalise_rails.rb` file.
Expand Down

0 comments on commit 2d8b0d3

Please sign in to comment.