missing_translations 0.1.0 → 0.2.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -9,18 +9,28 @@ namespace :missing_translations do
9
9
  context = "#{dir}.#{file}"
10
10
 
11
11
  File.readlines(view).map do |line|
12
- line.match(/\s+t\s*\(?['"]([^#]+?)['"]/i) do |m|
13
- arg = m[1]
14
- arg[0] == '.' ? "en.#{context}#{arg}" : "en.#{arg}"
12
+ line.scan(/\s+t\s*\(?['"]([^#+]+?)['"]/i).map do |m|
13
+ arg = m[0]
14
+ if arg != '.'
15
+ arg[0] == '.' ? "en.#{context}#{arg}" : "en.#{arg}"
16
+ end
15
17
  end
16
18
  end
17
19
  end
18
20
  used_keys = keys.compact.flatten.compact.uniq
19
21
 
22
+ # puts used_keys
23
+
20
24
  keys = Dir.glob('config/locales/*.yml').map { |locale| HashKeysDumper.dump YAML.load(File.read(locale)) }
21
25
  available_keys = keys.flatten
22
-
23
- puts 'Missing translations'
24
- puts (used_keys - available_keys)
26
+
27
+ missing_keys = (used_keys - available_keys)
28
+
29
+ if missing_keys.any?
30
+ puts 'Missing translations'
31
+ puts missing_keys
32
+ else
33
+ puts 'You have no missing translations'
34
+ end
25
35
  end
26
36
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "missing_translations"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrey Chernih"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: missing_translations
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrey Chernih
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: 2053559517941815740
115
+ hash: -1209027482231938804
116
116
  none: false
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements: