i18n-tasks 0.9.10 → 0.9.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/i18n/tasks/data/file_system_base.rb +21 -1
- data/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb +1 -1
- data/lib/i18n/tasks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43ba419e2a8a2c55b5a06ae4bebd614498107330
|
4
|
+
data.tar.gz: 1f61d868e4ed17245c9932eb2a0fc7e5d79ecb7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 013ee29af74037df89abd7e74c9bede1423d7274fa752fba8aca4d0f04c13408dc509df796cacd817ed090e766c89d7e3df5562543cec87aa58c6d288c1fe761
|
7
|
+
data.tar.gz: ef12279c48c34e3691ad826569d30b88b01cc9a082756c0d8d7bb5f3807de0fbd6c2076ad9bf66e5b2a59b3dde225752c7ebb752013b9958c58130f628b83a69
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
|
|
24
24
|
Add i18n-tasks to the Gemfile:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
gem 'i18n-tasks', '~> 0.9.
|
27
|
+
gem 'i18n-tasks', '~> 0.9.11'
|
28
28
|
```
|
29
29
|
|
30
30
|
Copy the default [configuration file](#configuration):
|
@@ -7,7 +7,7 @@ require 'i18n/tasks/key_pattern_matching'
|
|
7
7
|
|
8
8
|
module I18n::Tasks
|
9
9
|
module Data
|
10
|
-
class FileSystemBase
|
10
|
+
class FileSystemBase # rubocop:disable Metrics/ClassLength
|
11
11
|
include ::I18n::Tasks::Data::FileFormats
|
12
12
|
include ::I18n::Tasks::Logging
|
13
13
|
|
@@ -142,11 +142,31 @@ module I18n::Tasks
|
|
142
142
|
end.reduce(:+).map do |path|
|
143
143
|
[path.freeze, load_file(path) || {}]
|
144
144
|
end.map do |path, data|
|
145
|
+
filter_nil_keys! path, data
|
145
146
|
Data::Tree::Siblings.from_nested_hash(data).tap do |s|
|
146
147
|
s.leaves { |x| x.data.update(path: path, locale: locale) }
|
147
148
|
end
|
148
149
|
end.reduce(:merge!) || Tree::Siblings.null
|
149
150
|
end
|
151
|
+
|
152
|
+
def filter_nil_keys!(path, data, suffix = [])
|
153
|
+
data.each do |key, value|
|
154
|
+
if key.nil?
|
155
|
+
data.delete(key)
|
156
|
+
log_warn <<-TEXT
|
157
|
+
Skipping a nil key found in #{path.inspect}:
|
158
|
+
key: #{suffix.join('.')}.`nil`
|
159
|
+
value: #{value.inspect}
|
160
|
+
Nil keys are not supported by i18n.
|
161
|
+
The following unquoted YAML keys result in a nil key:
|
162
|
+
#{%w(null Null NULL ~).join(', ')}
|
163
|
+
See http://yaml.org/type/null.html
|
164
|
+
TEXT
|
165
|
+
elsif value.is_a?(Hash)
|
166
|
+
filter_nil_keys! path, value, suffix + [key]
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
150
170
|
end
|
151
171
|
end
|
152
172
|
end
|
data/lib/i18n/tasks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|