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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 234b68e06027a3335015a5818993014afea669efe42729d87f4de40efd4dc487
4
- data.tar.gz: 54a16b4f583813415a6801c62fda5eb9ee603e84bf65206700c0bc33b295b238
3
+ metadata.gz: 6e7ef3e878a1b5ffc7ae48ad8f683887e79073b3f34a5a3439656f5f7abb6e20
4
+ data.tar.gz: 2aac75f9cae7275812da73da0973de515baf0d78eb63e64182e683f8717696ca
5
5
  SHA512:
6
- metadata.gz: 2ab59ec749b2827c011728fe5711c850099d379d9089c2d73fc112def0f02c994b58ed646f42fe106c2d15d56cd5aaad1db636d7afe1504740109b57baca3c2f
7
- data.tar.gz: 9313168a8704e4985ae4a57d89fb6bc8dc47a5ac2f1ae6cdd73686aeec0fe657617776620db6a65c0c45b708ec2de06dc390d546509198a836b6ff7a14212ca3
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
@@ -1,3 +1,3 @@
1
1
  module RailsTranslationManager
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  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"
@@ -0,0 +1,4 @@
1
+ key,source,translation
2
+ unpublishing.title,The page you're looking for is no longer available,Ձեր փնտրած էջն այլևս հասանելի չէ
3
+ working_group.contact_details,Contact details,Կոնտակտային տվյալներ
4
+ working_group.policies,Policies,Քաղաքականություններ
@@ -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
- expect(RailsTranslationManager::Importer)
50
- .to have_received(:new)
51
- .with(locale: "fr",
52
- csv_path: "spec/locales/importer/fr.csv",
53
- import_directory: Rails.root.join("config", "locales"),
54
- multiple_files_per_language: true)
55
- expect(importer_instance).to have_received(:import)
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.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-04 00:00:00.000000000 Z
11
+ date: 2021-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails-i18n
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: activesupport
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-tasks
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