lokalise_manager 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +2 -1
- data/lib/lokalise_manager/global_config.rb +3 -1
- data/lib/lokalise_manager/task_definitions/exporter.rb +1 -1
- data/lib/lokalise_manager/task_definitions/importer.rb +1 -1
- data/lib/lokalise_manager/version.rb +1 -1
- data/lib/lokalise_manager.rb +0 -1
- data/lokalise_manager.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31b3524b3186c5fa2f6ff2f915cf45dc2cc26f69c615ff6d44fffd6581286222
|
4
|
+
data.tar.gz: 324ce28075eb3d6cacfda2076ac5b0d9b18a0750026e464e99ebb8b9aafa70d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 207900d1455053cc5246892f53ceed6027d2335ced167702e8f9c2eb977b0ce037f089cf447d8b4941bcd49d940de9d66a88c078df147c7ad23cad30e001b230
|
7
|
+
data.tar.gz: 14cc73a9f1a2fe3cad5716e9fe11bb68ad991eb239fc0d2aac45322b3237faf7644b7da403b2124733107e7f29a3e78cba3c510c77993d8f8339753112cd2b16
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.0.0 (09-Nov-2023)
|
4
|
+
|
5
|
+
* **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 4.0.0.
|
6
|
+
* **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 the `lang_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:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
lang_iso_inferer: ->(_data, path) { path.basename('.yml').to_s }
|
10
|
+
```
|
11
|
+
|
12
|
+
* Use ruby-lokalise-api v9.0.0
|
13
|
+
|
3
14
|
## 4.0.0 (27-Jul-2023)
|
4
15
|
|
5
16
|
* **Use ruby-lokalise-api version 8**. It should not introduce any breaking changes (as main methods have similar signatures) but you should be aware that v8 is a complete rewrite of the original SDK so please make sure your tests pass.
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
![Gem](https://img.shields.io/gem/v/lokalise_manager)
|
4
4
|
![CI](https://github.com/bodrovis/lokalise_manager/actions/workflows/ci.yml/badge.svg)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/github/bodrovis/lokalise_manager/badge.svg?branch=master)](https://coveralls.io/github/bodrovis/lokalise_manager?branch=master)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/9b682367a274ee3dcdee/maintainability)](https://codeclimate.com/github/bodrovis/lokalise_manager/maintainability)
|
6
7
|
![Downloads total](https://img.shields.io/gem/dt/lokalise_manager)
|
7
8
|
|
8
9
|
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.
|
@@ -202,7 +203,7 @@ If your translation files are not in YAML format, you will need to adjust the fo
|
|
202
203
|
* `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).
|
203
204
|
* `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 }`.
|
204
205
|
* `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 }`.
|
205
|
-
* `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 }`.
|
206
|
+
* `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.
|
206
207
|
|
207
208
|
### Customizing JSON parser and network adapter
|
208
209
|
|
@@ -99,8 +99,10 @@ module LokaliseManager
|
|
99
99
|
end
|
100
100
|
|
101
101
|
# Infers lang ISO for the given translation file
|
102
|
+
# The lambda expects to accept the raw contents of the translation file
|
103
|
+
# and the full path to the file (instance of the `Pathname` class)
|
102
104
|
def lang_iso_inferer
|
103
|
-
@lang_iso_inferer || ->(data) { YAML.safe_load(data)&.keys&.first }
|
105
|
+
@lang_iso_inferer || ->(data, _path) { YAML.safe_load(data)&.keys&.first }
|
104
106
|
end
|
105
107
|
end
|
106
108
|
end
|
@@ -84,7 +84,7 @@ module LokaliseManager
|
|
84
84
|
initial_opts = {
|
85
85
|
data: Base64.strict_encode64(content.strip),
|
86
86
|
filename: relative_p,
|
87
|
-
lang_iso: config.lang_iso_inferer.call(content)
|
87
|
+
lang_iso: config.lang_iso_inferer.call(content, full_p)
|
88
88
|
}
|
89
89
|
|
90
90
|
initial_opts.merge config.export_opts
|
data/lib/lokalise_manager.rb
CHANGED
data/lokalise_manager.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = 'https://github.com/bodrovis/lokalise_manager'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.platform = Gem::Platform::RUBY
|
16
|
-
spec.required_ruby_version = '>=
|
16
|
+
spec.required_ruby_version = '>= 3.0'
|
17
17
|
|
18
18
|
spec.files = Dir['README.md', 'LICENSE',
|
19
19
|
'CHANGELOG.md', 'lib/**/*.rb',
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.extra_rdoc_files = ['README.md']
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.add_dependency 'ruby-lokalise-api', '~>
|
26
|
+
spec.add_dependency 'ruby-lokalise-api', '~> 9.0'
|
27
27
|
spec.add_dependency 'rubyzip', '~> 2.3'
|
28
28
|
spec.add_dependency 'zeitwerk', '~> 2.4'
|
29
29
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lokalise_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Krukowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lokalise-api
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '9.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '9.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,14 +231,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
requirements:
|
232
232
|
- - ">="
|
233
233
|
- !ruby/object:Gem::Version
|
234
|
-
version: '
|
234
|
+
version: '3.0'
|
235
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
236
|
requirements:
|
237
237
|
- - ">="
|
238
238
|
- !ruby/object:Gem::Version
|
239
239
|
version: '0'
|
240
240
|
requirements: []
|
241
|
-
rubygems_version: 3.4.
|
241
|
+
rubygems_version: 3.4.21
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Lokalise integration for Ruby
|