- Minor code tweaks, use latest
lokalise_manager
that now enables asynchronous imports
- Breaking change: rename the
timeouts
config option toadditional_client_opts
. It has the same usage but now enables you to set both client timeouts and override the API host to send requests to.
additional_client_opts: {
open_timeout: 100,
timeout: 500,
api_host: 'http://example.com/api'
}
- Test with Rails 8
- Various updates
- Update documentation, minor code tweaks
- Breaking change: require Ruby 3+. Version 2.7 has reached end-of-life and thus we are not planning to support it anymore. If you need support for Ruby 2.7, please stay on 6.0.0.
- Potential breaking change: lambda returned by the
lang_iso_inferer
method has been slightly enhanced. It now accepts not only the file data but also the full path to the file. Therefore, if you redefine thelang_iso_inferer
option please make sure that the returned lambda accepts two params, not one. This way, you can be more flexible when inferring the locale. For example:
lang_iso_inferer: ->(_data, path) { path.basename('.yml').to_s }
- Use newer lokalise_manager and ruby-lokalise-api.
- Test with Ruby 3.3, do not test with Rails 6.0 (EOL)
- Use lokalise-manager v4 and ruby-lokalise-api v8. The latter is a major rewrite of the original SDK and has some breaking changes (however 95% of the methods have similar signatures). Therefore please make sure that your tests pass.
- Do not test with Ruby 2.7 (EOL)
- The gem can now be added to the
development
group instead ofproduction
to reduce the bundle size - Update dependences, test with Ruby 3.2
- Fixed an issue with
\n
being improperly imported - Changed default
yaml
format toruby_yaml
- Update dependencies
- Fix issue with Zeitwerk and files loading
- Breaking change: require Ruby 2.7+
- Use Zeitwerk loader
- Use newer LokaliseManager (v3) and RubyLokaliseApi (v6)
- Prettify code
- File exporting is now multi-threaded as Lokalise API started to support parallel requests since January 2022
- Test with Ruby 3.1
This is a major re-write of this gem. The actual import/export functionality was extracted to a separate gem called lokalise_manager that you can use to run your tasks programmatically from any Ruby scripts (powered or not powered by Rails). LokaliseRails now has only the Rails-related logic (even though it should probably work with other frameworks as well).
- Breaking change: the global config class is renamed therefore update your
config/lokalise_rails.rb
file to look like this:
LokaliseRails::GlobalConfig.config do |c|
# ...your configuration options provided as before...
end
- Breaking change: the
branch
config option now has""
set as default value (it was"master"
previously). Therefore, you might need to explicitly state which branch to use now:
LokaliseRails::GlobalConfig.config do |c|
c.branch = "master"
end
- Breaking change: to run your task prommatically, use a new approach:
LokaliseManager.importer(optional_config, global_config_object).import!
LokaliseManager.exporter(optional_config, global_config_object).export!
- Please check this document section to learn more about running tasks programmatically. This change doesn't have any effect on you if you're using only Rake tasks to import/export files.
- No need to say
require 'lokalise_rails
in yourlokalise_rails.rb
config file anymore.
- Add exponential backoff mechanism for file imports to comply with the upcoming API changes ("rate limiting"), see below for more details.
- Add
max_retries_import
option with a default value of5
.
- Lokalise is introducing API rate limiting. Access to all endpoints will be limited to 6 requests per second from 14 September, 2021. This limit is applied per API token and per IP address. If you exceed the limit, a 429 HTTP status code will be returned and a
Lokalise::Error::TooManyRequests
exception will be raised. Therefore, to overcome this issue LokaliseRails is introducing an exponential backoff mechanism for file exports. Why? Because if you have, say, 10 translation files, we'll have to send 10 separate API requests which will probably mean exceeding the limit (this is not the case with importing as we're always receiving a single archive). Thus, if the HTTP status code 429 was received, we'll do the following:
sleep 2 ** retries
retries += 1
- If the maximum number of retries has been reached LokaliseRails will re-raise the
Lokalise::Error::TooManyRequests
error and give up. By default, the maximum number of retries is set to5
but you can control it using themax_retries_export
option. - Enabled compression for the API client.
- Re-worked exception handling. Now when something goes wrong during the import or export process, this gem will re-raise all such errors (previously it just printed out some errors to the
$stdout
). If you run a Rake task, it will exit with a status code1
and the actual error message. If you run a task programattically, you'll get an exception. - Dropped support for Ruby 2.5
- Test against Ruby 3
- A bit better exception handling
- Update dependencies
- Use ruby-lokalise-api v3
- New option
translations_loader
- New option
translations_converter
- New option
lang_iso_inferer
- New option
branch
- New option
timeouts
- New method
.reset_api_client!
for the task definitions
- Minor bug fixes and spec updates
- Added export feature
- More convenient configuration and additional options
- Other major enhancements
- Allow to override options properly
- Initial (proper) release