immosquare-yaml 0.1.3 → 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: 036dbd81c5acc9b557da4d9765e2b2ebf24d5f574943461d6bd544cf33ab5f20
4
- data.tar.gz: fd3c98b6489a5072191a99fffe9e16605b90221b72d85c29a3bc405f0fa47df9
3
+ metadata.gz: 50e7d05885b777e715b408072108ddcaae7936b709389813b8887d92f5184f15
4
+ data.tar.gz: ff4a85e7b21ac1e42b7a702be0e8b1fa597bc23ed4cf016690cdad703fc7ca47
5
5
  SHA512:
6
- metadata.gz: 107c708c81effd4afb3118aa77faff2a99861aa6ad2a91adc66344264351fc060ee73bbe873478c0bd5c2d3042e3236b2ed1f2fa9462594e77e773fffc7f7f16
7
- data.tar.gz: 546f425d1df76736a6986345f4375cd3d4cf8a597ed364ba06f3757e2be584805be90f9124babdc8af16d298bcc002f4902674f376e51358f343c3affe26140e
6
+ metadata.gz: bcac3817a355e9a734e4d4686d54716c86eef5fcb399c5644ed55a3a4dc14a4d6f453045c739dfbfb9a061812d9d5ef0322d94144568143f3a051729e18f5036
7
+ data.tar.gz: a64600294f32924511fbd9ede26f83469ba0497a44986c7573053d8cd2c2f16807b5dabe3db4e5624ceaaa45bf8c73ea036acf2987aa8ae1499edf119ebd8b4f
@@ -1,3 +1,3 @@
1
1
  module ImmosquareYaml
2
- VERSION = "0.1.3".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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE