translations_sync 0.4.11 → 0.4.12

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
  SHA1:
3
- metadata.gz: e9a9a2cd5c0ae7b3b337952c5d422bbfb65a3fce
4
- data.tar.gz: 796c4d67badda5d44d3a1fb1cfbc2cb580ee59fb
3
+ metadata.gz: 9bbb466d5bec48738d3f8978811adfc55382257b
4
+ data.tar.gz: a0ec22498cc2b69d9e6d7023246576b2f986aeba
5
5
  SHA512:
6
- metadata.gz: dfd517b9cf6af58487e9877d4df788ac15eba7126f02109694e1567af00519b9fb83506bb61af82571b94faf3735150212230ea3da0e39edbc9dad970ffdc6dd
7
- data.tar.gz: 59954867d39edc66420b7f2e92109591192d10f5256033a747f1dbaabb86a3f68fd8e20ed975c9b45b3b94f6a75a47731d95415eb7b7dfd66113414cd576641b
6
+ metadata.gz: 4e0e0fe429de9083f2123081c4ad1f66d0b93ac9351e897790350abb041f9ad67c47e5a03888ace3dca09a860b8996691c756439be7347b1c82cc44df718e5cf
7
+ data.tar.gz: 4139b16d2849f70f77b861db31c8b23865d3ac74b4a40e49f46e94751c1cdb352edb4ef88ec1e4f8d39e1c6a07e7f2718451bf2f6b2e830b73bb85a0f226bc37
data/README CHANGED
@@ -66,6 +66,8 @@ This parameter tells to use the given name as **base name**.
66
66
  If any of the corresponding files exist, the missing translations will
67
67
  be added to them.
68
68
  * `SOURCE=name`. Only files with the given **base name** will be considered.
69
+ * `GEMS=list`. When `SOURCE` is in effect additionally the translations from
70
+ the listed gems will be included.
69
71
  * `IN=name`. It is equivalent to `NAME=name SOURCE=name`
70
72
  * `KEY=path.to.key`. Points to the key to be moved or removed.
71
73
  Obviously, it should not include locale.
@@ -10,6 +10,7 @@ namespace :translations do
10
10
  params[:exclude] = ENV['EXCLUDE']
11
11
  params[:source] = ENV['SOURCE'] || ENV['IN'] unless skip_source
12
12
  params[:ignore] = ENV['IGNORE']
13
+ params[:gems] = ENV['GEMS']
13
14
  TranslationsSync.new params
14
15
  end
15
16
 
@@ -97,8 +97,11 @@ class TranslationsSync
97
97
 
98
98
  if source
99
99
  translations_path_re = Regexp.new "#{translations_dir}(\\/[a-z]{2}(?:-[A-Z]{2})?)?\\/#{Regexp.escape source}(?:(_|\\.)[a-z]{2}(?:-[A-Z]{2})?)?\\.(?:yml|rb)\\Z"
100
- I18n.load_path.reject! do |path|
101
- path !~ translations_path_re
100
+ gems = params[:gems].to_s.split(',')
101
+ I18n.load_path.select! do |path|
102
+ gem = gems.detect{|gem| path =~ /gems\/#{gem}/}
103
+ puts "#{path}" if gem
104
+ gem or path =~ translations_path_re
102
105
  end
103
106
  end
104
107
 
@@ -149,6 +152,9 @@ class TranslationsSync
149
152
  push_to_hash @missing[lang], lang, key, val, :missing
150
153
  end
151
154
  end
155
+ locales_with_missing.each do |lang|
156
+ @missing.delete lang if @missing[lang] == {}
157
+ end
152
158
  @missing.stringify_keys!
153
159
  end
154
160
  @missing
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translations_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff