rails_translation_manager 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rails_translation_manager/importer.rb +1 -1
- data/lib/rails_translation_manager/version.rb +1 -1
- data/rails_translation_manager.gemspec +2 -1
- data/spec/locales/importer/hy_with_byte_order_mark.csv +4 -0
- data/spec/rails_translation_manager/importer_spec.rb +12 -0
- data/spec/tasks/translation_spec.rb +12 -8
- metadata +21 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e7ef3e878a1b5ffc7ae48ad8f683887e79073b3f34a5a3439656f5f7abb6e20
|
4
|
+
data.tar.gz: 2aac75f9cae7275812da73da0973de515baf0d78eb63e64182e683f8717696ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0b2fa6abaadb21ea912976b1092c6459ea0194a8e19092c522e38224da218395d230936d0d4a0aa830e3d37bd9f6eb6ac1e4909bd5406369c0aa99d1a4d13f4
|
7
|
+
data.tar.gz: 0dbbefe8208052b63f5ddc80734340ed7985b199f9113aaf5457c48d50e34e889e7379a20c61963b002343f4fb0d35aacc0307b442a15a2b7fbdea77c25349dd
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.1.2
|
2
|
+
|
3
|
+
Handle importing files that contain Byte Order Marks. https://github.com/alphagov/rails_translation_manager/pull/27
|
4
|
+
|
1
5
|
## 1.1.1
|
2
6
|
|
3
7
|
Fix Rails Translation Manager / Rails naming clash for class. https://github.com/alphagov/rails_translation_manager/pull/26
|
@@ -15,7 +15,7 @@ class RailsTranslationManager::Importer
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def import
|
18
|
-
csv = CSV.read(csv_path, headers: true, header_converters: :downcase)
|
18
|
+
csv = CSV.read(csv_path, encoding: "bom|utf-8", headers: true, header_converters: :downcase)
|
19
19
|
|
20
20
|
multiple_files_per_language ? import_csv_into_multiple_files(csv) : import_csv(csv)
|
21
21
|
end
|
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "rails-i18n"
|
22
21
|
spec.add_dependency "activesupport"
|
22
|
+
spec.add_dependency "csv", "~> 3.2"
|
23
23
|
spec.add_dependency "i18n-tasks"
|
24
|
+
spec.add_dependency "rails-i18n"
|
24
25
|
|
25
26
|
spec.add_development_dependency "bundler"
|
26
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -4,6 +4,18 @@ require "tmpdir"
|
|
4
4
|
RSpec.describe RailsTranslationManager::Importer do
|
5
5
|
let(:import_directory) { Dir.mktmpdir }
|
6
6
|
|
7
|
+
it "imports CSV containing a byte order mark" do
|
8
|
+
importer = described_class.new(
|
9
|
+
locale: "hy",
|
10
|
+
csv_path: "spec/locales/importer/hy_with_byte_order_mark.csv",
|
11
|
+
import_directory: import_directory,
|
12
|
+
multiple_files_per_language: false
|
13
|
+
)
|
14
|
+
importer.import
|
15
|
+
|
16
|
+
expect(File).to exist(import_directory + "/hy.yml")
|
17
|
+
end
|
18
|
+
|
7
19
|
context "when there is one locale file per language" do
|
8
20
|
let(:yaml_translation_data) { YAML.load_file(import_directory + "/fr.yml")["fr"] }
|
9
21
|
|
@@ -45,14 +45,18 @@ describe "rake tasks" do
|
|
45
45
|
|
46
46
|
it "calls the importer class for each target path" do
|
47
47
|
task.execute(csv_directory: csv_directory, multiple_files_per_language: true)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
import_paths = Dir["spec/locales/importer/*.csv"]
|
49
|
+
|
50
|
+
import_paths.each do |csv_path|
|
51
|
+
expect(RailsTranslationManager::Importer)
|
52
|
+
.to have_received(:new)
|
53
|
+
.with(locale: File.basename(csv_path, ".csv"),
|
54
|
+
csv_path: csv_path,
|
55
|
+
import_directory: Rails.root.join("config", "locales"),
|
56
|
+
multiple_files_per_language: true)
|
57
|
+
end
|
58
|
+
|
59
|
+
expect(importer_instance).to have_received(:import).exactly(import_paths.count)
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_translation_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edd Sowden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,7 +25,21 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: csv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: i18n-tasks
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: i18n
|
56
|
+
name: rails-i18n
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -161,6 +175,7 @@ files:
|
|
161
175
|
- spec/locales/cleaner/clean.yml
|
162
176
|
- spec/locales/cleaner/with_whitespace.yml
|
163
177
|
- spec/locales/importer/fr.csv
|
178
|
+
- spec/locales/importer/hy_with_byte_order_mark.csv
|
164
179
|
- spec/locales/in_sync/cy/browse.yml
|
165
180
|
- spec/locales/in_sync/en/browse.yml
|
166
181
|
- spec/locales/out_of_sync/cy.yml
|
@@ -208,6 +223,7 @@ test_files:
|
|
208
223
|
- spec/locales/cleaner/clean.yml
|
209
224
|
- spec/locales/cleaner/with_whitespace.yml
|
210
225
|
- spec/locales/importer/fr.csv
|
226
|
+
- spec/locales/importer/hy_with_byte_order_mark.csv
|
211
227
|
- spec/locales/in_sync/cy/browse.yml
|
212
228
|
- spec/locales/in_sync/en/browse.yml
|
213
229
|
- spec/locales/out_of_sync/cy.yml
|