i18n-tasks 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/bin/i18n-tasks +1 -0
- data/lib/i18n/tasks/data.rb +6 -0
- data/lib/i18n/tasks/data/tree/nodes.rb +4 -0
- data/lib/i18n/tasks/fill_tasks.rb +2 -2
- data/lib/i18n/tasks/missing_keys.rb +1 -5
- 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: a5b450d463f4c435b2c29cb8625c0fc3b2f1f0fc
|
4
|
+
data.tar.gz: 8f3a640623471a782e3a3321aae671f51bf4c94d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d95d020a9f643480f5e8022b69976355aafe6ed66955eeeb12a25f12c3aa4bce11f3d10e5807c29636690f087f289e089b21fc0634b251b26090f83690037a5
|
7
|
+
data.tar.gz: 0f2186c5897c723eb587af3471214c6b372590ce8f79e615aeb32afb7627aba003772061a44f2165908aeb000bd2067a64d077bbd7395fd85f04ef2d86617b64
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,7 @@ i18n-tasks can be used with any project using [i18n][i18n-gem] (default in Rails
|
|
18
18
|
Add to Gemfile:
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
gem 'i18n-tasks', '~> 0.4.
|
21
|
+
gem 'i18n-tasks', '~> 0.4.4'
|
22
22
|
```
|
23
23
|
|
24
24
|
i18n-tasks does not load or execute any of the application's code but performs static-only analysic.
|
data/bin/i18n-tasks
CHANGED
data/lib/i18n/tasks/data.rb
CHANGED
@@ -21,6 +21,12 @@ module I18n::Tasks
|
|
21
21
|
data.t(key, locale)
|
22
22
|
end
|
23
23
|
|
24
|
+
def missing_tree(locale, compared_to = base_locale)
|
25
|
+
data[compared_to].select_keys(root: false) { |key, node|
|
26
|
+
!key_value?(key, locale) && !ignore_key?(key, :missing)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
24
30
|
def tree(locale)
|
25
31
|
data[locale][locale].children
|
26
32
|
end
|
@@ -11,8 +11,8 @@ module I18n::Tasks::FillTasks
|
|
11
11
|
def fill_missing_google_translate(opts = {})
|
12
12
|
from = opts[:from] || base_locale
|
13
13
|
opts = opts.merge(
|
14
|
-
locales:
|
15
|
-
keys: proc { |locale|
|
14
|
+
locales: Array(opts[:locales]) - Array(from),
|
15
|
+
keys: proc { |locale| missing_tree(locale, from).key_names.map(&:to_s) },
|
16
16
|
values: proc { |keys, locale|
|
17
17
|
google_translate(keys.zip(keys.map(&t_proc(from))), to: locale, from: from).map(&:last)
|
18
18
|
}
|
@@ -42,11 +42,7 @@ module I18n::Tasks
|
|
42
42
|
return keys_missing_from_base if locale == base_locale
|
43
43
|
@keys_missing_from_locale ||= {}
|
44
44
|
@keys_missing_from_locale[locale] ||= begin
|
45
|
-
keys =
|
46
|
-
key = depluralize_key(key, locale)
|
47
|
-
next if ignore_key?(key, :missing) || key_value?(key, locale)
|
48
|
-
key
|
49
|
-
}.compact.uniq
|
45
|
+
keys = missing_tree(locale).key_names.map { |key| depluralize_key(key, locale) }.uniq
|
50
46
|
KeyGroup.new keys, type: :missing_from_locale, locale: locale
|
51
47
|
end
|
52
48
|
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.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubis
|