lokalise_rails 5.2.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile +2 -1
- data/LICENSE +1 -1
- data/README.md +28 -2
- data/lib/generators/templates/lokalise_rails_config.rb +1 -1
- data/lib/lokalise_rails/version.rb +2 -2
- data/lokalise_rails.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: 055e2da3772d39a53014aae0b3d1443022a8351745ce7480b68fc368823e5f1a
|
4
|
+
data.tar.gz: 9d114b3d375e979bb6d181a553e4c8632fb0d6cd21886793bfe96160ed37f013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9768e69e5b230f61e78279f44c8a78b085d269c776ae8562287f2eeca323b87a2fbfae8edb985a4c0cfec02929fde789bac83ade2babad08969e69dab962fbcd
|
7
|
+
data.tar.gz: 7c899b9c9e13d839e2e9ff580e44efa8394f6cffbd74d9e425ec87338fb5e276ed4e44dd353e6320fcb01a0ea9596e22f5c590357ab02be2e0f523d731f2a1e6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 7.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 6.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 newer lokalise_manager and ruby-lokalise-api.
|
13
|
+
* Test with Ruby 3.3, do not test with Rails 6.0 (EOL)
|
14
|
+
|
15
|
+
## 6.0.0 (27-Jul-2023)
|
16
|
+
|
17
|
+
* 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.
|
18
|
+
* Do not test with Ruby 2.7 (EOL)
|
19
|
+
|
3
20
|
## 5.2.0 (26-Jan-2023)
|
4
21
|
|
5
22
|
* The gem can now be added to the `development` group instead of `production` to reduce the bundle size
|
data/Gemfile
CHANGED
@@ -6,7 +6,7 @@ gemspec
|
|
6
6
|
|
7
7
|
group :test do
|
8
8
|
gem 'dotenv', '~> 2.5'
|
9
|
-
gem 'rails', '~> 7.
|
9
|
+
gem 'rails', '~> 7.1'
|
10
10
|
gem 'rake', '~> 13.0'
|
11
11
|
gem 'rspec', '~> 3.6'
|
12
12
|
gem 'rubocop', '~> 1.0'
|
@@ -14,6 +14,7 @@ group :test do
|
|
14
14
|
gem 'rubocop-rake', '~> 0.6'
|
15
15
|
gem 'rubocop-rspec', '~> 2.6'
|
16
16
|
gem 'simplecov', '~> 0.22'
|
17
|
+
gem 'simplecov-lcov', '~> 0.8'
|
17
18
|
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
|
18
19
|
gem 'webmock', '~> 3.14'
|
19
20
|
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|

|
4
4
|

|
5
|
+
[](https://coveralls.io/github/bodrovis/lokalise_rails?branch=master)
|
6
|
+
[](https://codeclimate.com/github/bodrovis/lokalise_rails/maintainability)
|
5
7
|

|
6
8
|
|
7
9
|
This gem provides [Lokalise](http://lokalise.com) integration for Ruby on Rails and allows to exchange translation files easily. It relies on [lokalise_manager](https://github.com/bodrovis/lokalise_manager) which perform the actual import/export and can be used to run this task in any Ruby script.
|
@@ -101,6 +103,30 @@ importer.import!
|
|
101
103
|
exporter.export!
|
102
104
|
```
|
103
105
|
|
106
|
+
### Example: Multiple translation paths
|
107
|
+
|
108
|
+
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:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
require 'rake'
|
112
|
+
require 'lokalise_rails'
|
113
|
+
require "#{LokaliseRails::Utils.root}/config/lokalise_rails"
|
114
|
+
|
115
|
+
namespace :lokalise_custom do
|
116
|
+
task :export do
|
117
|
+
# importing from the default directory (./config/locales/)
|
118
|
+
exporter = LokaliseManager.exporter({}, LokaliseRails::GlobalConfig)
|
119
|
+
exporter.export!
|
120
|
+
|
121
|
+
# importing from the custom directory
|
122
|
+
exporter = LokaliseManager.exporter({locales_path: "#{Rails.root}/config/custom_locales"}, LokaliseRails::GlobalConfig)
|
123
|
+
exporter.export!
|
124
|
+
rescue StandardError => e
|
125
|
+
abort e.inspect
|
126
|
+
end
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
104
130
|
## Configuration
|
105
131
|
|
106
132
|
Options are specified in the `config/lokalise_rails.rb` file.
|
@@ -158,7 +184,7 @@ LokaliseRails::GlobalConfig.config do |c|
|
|
158
184
|
## c.translations_converter = ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
|
159
185
|
|
160
186
|
## Infer language ISO code for the translation file:
|
161
|
-
## c.lang_iso_inferer = ->(data) { YAML.safe_load(data)&.keys&.first }
|
187
|
+
## c.lang_iso_inferer = ->(data, _path) { YAML.safe_load(data)&.keys&.first }
|
162
188
|
end
|
163
189
|
```
|
164
190
|
|
@@ -169,4 +195,4 @@ end
|
|
169
195
|
|
170
196
|
## License
|
171
197
|
|
172
|
-
Copyright (c) [
|
198
|
+
Copyright (c) [Ilya Krukowski](http://bodrovis.tech). License type is [MIT](https://github.com/bodrovis/lokalise_rails/blob/master/LICENSE).
|
@@ -51,6 +51,6 @@ if defined?(LokaliseRails) && defined?(LokaliseRails::GlobalConfig)
|
|
51
51
|
## c.translations_converter = ->(raw_data) { YAML.dump(raw_data).gsub(/\\\\n/, '\n') }
|
52
52
|
|
53
53
|
## Infer language ISO code for the translation file:
|
54
|
-
## c.lang_iso_inferer = ->(data) { YAML.safe_load(data)&.keys&.first }
|
54
|
+
## c.lang_iso_inferer = ->(data, _path) { YAML.safe_load(data)&.keys&.first }
|
55
55
|
end
|
56
56
|
end
|
data/lokalise_rails.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = 'https://github.com/bodrovis/lokalise_rails'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
spec.platform = Gem::Platform::RUBY
|
15
|
-
spec.required_ruby_version = '>=
|
15
|
+
spec.required_ruby_version = '>= 3.0'
|
16
16
|
|
17
17
|
spec.files = Dir['README.md', 'LICENSE',
|
18
18
|
'CHANGELOG.md', 'lib/**/*.rb',
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.extra_rdoc_files = ['README.md']
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_dependency 'lokalise_manager', '~>
|
25
|
+
spec.add_dependency 'lokalise_manager', '~> 5.0'
|
26
26
|
spec.add_dependency 'zeitwerk', '~> 2.4'
|
27
27
|
|
28
28
|
spec.metadata = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lokalise_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.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: lokalise_manager
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.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: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: zeitwerk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,14 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
80
|
+
version: '3.0'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
rubygems_version: 3.4.
|
87
|
+
rubygems_version: 3.4.21
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Lokalise integration for Ruby on Rails
|