immosquare-yaml 0.1.2 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ace65cc1c3b599449f0c7af622e242507a010262e536484c1424bb19eeb9ba3
4
- data.tar.gz: b10ce8e8239464b58ff87be76512db3fd2731c38aabf256d4f917d26e5cc8ede
3
+ metadata.gz: 50e7d05885b777e715b408072108ddcaae7936b709389813b8887d92f5184f15
4
+ data.tar.gz: ff4a85e7b21ac1e42b7a702be0e8b1fa597bc23ed4cf016690cdad703fc7ca47
5
5
  SHA512:
6
- metadata.gz: '048cdac2661a8ab810c12547f5e398612b5a6f94788340055cf8e46b004f3a357b9c1269f210bf29e75fa329248d86f4a92108ad097aabcf39fe91b722af5d12'
7
- data.tar.gz: f4eddc1f73762f31a84b6f2b30e5dbc2bcc7c63ce8f5cb83a8ad5668dbde11d71d3a7aed5b37d0c7bf7c8fef02e0e74743bb0f992ccc9ae304b27adf37ff5da8
6
+ metadata.gz: bcac3817a355e9a734e4d4686d54716c86eef5fcb399c5644ed55a3a4dc14a4d6f453045c739dfbfb9a061812d9d5ef0322d94144568143f3a051729e18f5036
7
+ data.tar.gz: a64600294f32924511fbd9ede26f83469ba0497a44986c7573053d8cd2c2f16807b5dabe3db4e5624ceaaa45bf8c73ea036acf2987aa8ae1499edf119ebd8b4f
@@ -312,7 +312,11 @@ module ImmosquareYaml
312
312
  ## We put the translations in the original array
313
313
  ##============================================================##
314
314
  ai_resuslts.each do |index, translation|
315
- array[index][2] = translation
315
+ begin
316
+ array[index.to_i][2] = translation
317
+ rescue StandardError => e
318
+ puts(e.message)
319
+ end
316
320
  end
317
321
 
318
322
  ##============================================================##
@@ -1,3 +1,3 @@
1
1
  module ImmosquareYaml
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.4".freeze
3
3
  end
@@ -2,15 +2,22 @@ namespace :immosquare_yaml do
2
2
 
3
3
  ##============================================================##
4
4
  ## Function to translate translation files in rails app
5
+ ## rake immosquare_yaml:translate LOCALE=fr
5
6
  ##============================================================##
6
7
  desc "Translate translation files in rails app"
7
8
  task :translate => :environment do
8
- source_locale = "fr"
9
- locales = I18n.available_locales.map(&:to_s).reject {|l| l == source_locale }
10
- Dir.glob("#{Rails.root}/config/locales/**/*#{source_locale}.yml").each do |file|
11
- locales.each do |locale|
12
- ImmosquareYaml::Translate.translate(file, locale)
9
+ begin
10
+ source_locale = ENV.fetch("LOCALE", nil) || "fr"
11
+ raise("Please provide a valid locale") if !I18n.available_locales.map(&:to_s).include?(source_locale)
12
+
13
+ locales = I18n.available_locales.map(&:to_s).reject {|l| l == source_locale }
14
+ Dir.glob("#{Rails.root}/config/locales/**/*#{source_locale}.yml").each do |file|
15
+ locales.each do |locale|
16
+ ImmosquareYaml::Translate.translate(file, locale)
17
+ end
13
18
  end
19
+ rescue StandardError => e
20
+ puts(e.message)
14
21
  end
15
22
  end
16
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE