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 +4 -4
- data/README +2 -0
- data/lib/tasks/translations_sync.rake +1 -0
- data/lib/translations_sync.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bbb466d5bec48738d3f8978811adfc55382257b
|
4
|
+
data.tar.gz: a0ec22498cc2b69d9e6d7023246576b2f986aeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/translations_sync.rb
CHANGED
@@ -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
|
-
|
101
|
-
|
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
|