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 +4 -4
- data/lib/immosquare-yaml/version.rb +1 -1
- data/lib/tasks/immosquare-yaml.rake +12 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e7d05885b777e715b408072108ddcaae7936b709389813b8887d92f5184f15
|
4
|
+
data.tar.gz: ff4a85e7b21ac1e42b7a702be0e8b1fa597bc23ed4cf016690cdad703fc7ca47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcac3817a355e9a734e4d4686d54716c86eef5fcb399c5644ed55a3a4dc14a4d6f453045c739dfbfb9a061812d9d5ef0322d94144568143f3a051729e18f5036
|
7
|
+
data.tar.gz: a64600294f32924511fbd9ede26f83469ba0497a44986c7573053d8cd2c2f16807b5dabe3db4e5624ceaaa45bf8c73ea036acf2987aa8ae1499edf119ebd8b4f
|
@@ -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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
|