README.md in lokalise_manager-4.0.0 vs README.md in lokalise_manager-5.0.0
- old
+ new
@@ -1,10 +1,11 @@
# LokaliseManager
![Gem](https://img.shields.io/gem/v/lokalise_manager)
![CI](https://github.com/bodrovis/lokalise_manager/actions/workflows/ci.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/bodrovis/lokalise_manager/badge.svg?branch=master)](https://coveralls.io/github/bodrovis/lokalise_manager?branch=master)
+[![Maintainability](https://api.codeclimate.com/v1/badges/9b682367a274ee3dcdee/maintainability)](https://codeclimate.com/github/bodrovis/lokalise_manager/maintainability)
![Downloads total](https://img.shields.io/gem/dt/lokalise_manager)
This gem provides [Lokalise](http://lokalise.com) integration for Ruby and allows to exchange translation files between your project and TMS easily. It relies on [ruby-lokalise-api](https://lokalise.github.io/ruby-lokalise-api) to send APIv2 requests.
If you are looking for a Rails integration, please check [lokalise_rails](https://github.com/bodrovis/lokalise_rails) which provides a set of Rake tasks for importing/exporting.
@@ -200,10 +201,10 @@
If your translation files are not in YAML format, you will need to adjust the following options:
* `file_ext_regexp` (`regexp`) — regular expression applied to file extensions to determine which files should be imported and exported. Defaults to `/\.ya?ml\z/i` (YAML files).
* `translations_loader` (`lambda` or `proc`) — loads translations data and makes sure they are valid before saving them to a translation file. Defaults to `->(raw_data) { YAML.safe_load raw_data }`. In the simplest case you may just return the data back, for example `-> (raw_data) { raw_data }`.
* `translations_converter` (`lambda` or `proc`) — converts translations data to a proper format before saving them to a translation file. Defaults to `->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }`. In the simplest case you may just return the data back, for example `-> (raw_data) { raw_data }`.
-* `lang_iso_inferer` (`lambda` or `proc`) — infers language ISO code based on the translation file data before uploading it to Lokalise. Defaults to `->(data) { YAML.safe_load(data)&.keys&.first }`.
+* `lang_iso_inferer` (`lambda` or `proc`) — infers language ISO code based on the translation file data and path before uploading it to Lokalise. Defaults to `->(data, _path) { YAML.safe_load(data)&.keys&.first }`. To infer locale based on the filename, you can use something like `->(_data, path) { path.basename('.yml').to_s }`. `path` is an instance of the `Pathname` class.
### Customizing JSON parser and network adapter
JSON parser and network adapter utilized by lokalise_manager can be customized as well. Please check [ruby-lokalise-api doc](https://lokalise.github.io/ruby-lokalise-api/additional_info/customization) to learn more.