lokalise_rails 5.2.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f210fb25454eb844cf639a709f81271aad408589d9b0269e6553fcfc02d112c
4
- data.tar.gz: c2063c8f253c577412797aad2e2299cde7c715439fb2ddfc34b27c2c592ba7d2
3
+ metadata.gz: 055e2da3772d39a53014aae0b3d1443022a8351745ce7480b68fc368823e5f1a
4
+ data.tar.gz: 9d114b3d375e979bb6d181a553e4c8632fb0d6cd21886793bfe96160ed37f013
5
5
  SHA512:
6
- metadata.gz: ef1fd7e991348827a51f221851a9343ce473b1c1c8b85b77b63feb70ed22d15231d1339c8371e3435fa59543c6a52448470e7800c03e8d54402464251263bfe0
7
- data.tar.gz: bcb9c3741313418c3fc35c121071884cdd7083ad8d66fb1d8f41357d7df68cfbfefd65dae677a73ea5e5361d7b914e64751429a89221804bd65b1bf62879b06f
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.0.4'
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
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Lokalise team, Ilya Krukowski
3
+ Copyright (c) 2023 Ilya Krukowski
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ![Gem](https://img.shields.io/gem/v/lokalise_rails)
4
4
  ![CI](https://github.com/bodrovis/lokalise_rails/actions/workflows/ci.yml/badge.svg)
5
+ [![Coverage Status](https://coveralls.io/repos/github/bodrovis/lokalise_rails/badge.svg?branch=master)](https://coveralls.io/github/bodrovis/lokalise_rails?branch=master)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/6e5c98f76227de00b0f2/maintainability)](https://codeclimate.com/github/bodrovis/lokalise_rails/maintainability)
5
7
  ![Downloads total](https://img.shields.io/gem/dt/lokalise_rails)
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) [Lokalise team](http://lokalise.com), [Ilya Krukowski](http://bodrovis.tech). License type is [MIT](https://github.com/bodrovis/lokalise_rails/blob/master/LICENSE).
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LokaliseRails
4
- VERSION = '5.2.0'
5
- end
4
+ VERSION = '7.0.0'
5
+ end
@@ -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 = '>= 2.7.0'
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', '~> 3.2'
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: 5.2.0
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-01-26 00:00:00.000000000 Z
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: '3.2'
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: '3.2'
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: 2.7.0
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.5
87
+ rubygems_version: 3.4.21
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Lokalise integration for Ruby on Rails