i18n-tasks 0.9.12 → 0.9.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -8
- data/Rakefile +1 -0
- data/i18n-tasks.gemspec +2 -1
- data/lib/i18n/tasks.rb +2 -1
- data/lib/i18n/tasks/base_task.rb +1 -0
- data/lib/i18n/tasks/cli.rb +4 -3
- data/lib/i18n/tasks/command/collection.rb +1 -0
- data/lib/i18n/tasks/command/commander.rb +1 -0
- data/lib/i18n/tasks/command/commands/data.rb +6 -5
- data/lib/i18n/tasks/command/commands/eq_base.rb +2 -1
- data/lib/i18n/tasks/command/commands/health.rb +2 -1
- data/lib/i18n/tasks/command/commands/meta.rb +2 -1
- data/lib/i18n/tasks/command/commands/missing.rb +2 -1
- data/lib/i18n/tasks/command/commands/tree.rb +5 -4
- data/lib/i18n/tasks/command/commands/usages.rb +9 -8
- data/lib/i18n/tasks/command/commands/xlsx.rb +2 -1
- data/lib/i18n/tasks/command/dsl.rb +1 -0
- data/lib/i18n/tasks/command/option_parsers/enum.rb +1 -0
- data/lib/i18n/tasks/command/option_parsers/locale.rb +2 -1
- data/lib/i18n/tasks/command/options/common.rb +1 -0
- data/lib/i18n/tasks/command/options/data.rb +1 -0
- data/lib/i18n/tasks/command/options/locales.rb +1 -0
- data/lib/i18n/tasks/command_error.rb +1 -0
- data/lib/i18n/tasks/commands.rb +1 -1
- data/lib/i18n/tasks/configuration.rb +1 -0
- data/lib/i18n/tasks/console_context.rb +9 -10
- data/lib/i18n/tasks/data.rb +1 -0
- data/lib/i18n/tasks/data/adapter/json_adapter.rb +1 -0
- data/lib/i18n/tasks/data/adapter/yaml_adapter.rb +1 -0
- data/lib/i18n/tasks/data/file_formats.rb +1 -0
- data/lib/i18n/tasks/data/file_system.rb +1 -0
- data/lib/i18n/tasks/data/file_system_base.rb +1 -0
- data/lib/i18n/tasks/data/router/conservative_router.rb +1 -0
- data/lib/i18n/tasks/data/router/pattern_router.rb +1 -0
- data/lib/i18n/tasks/data/tree/node.rb +5 -4
- data/lib/i18n/tasks/data/tree/nodes.rb +2 -1
- data/lib/i18n/tasks/data/tree/siblings.rb +1 -0
- data/lib/i18n/tasks/data/tree/traversal.rb +1 -0
- data/lib/i18n/tasks/google_translation.rb +1 -0
- data/lib/i18n/tasks/html_keys.rb +1 -0
- data/lib/i18n/tasks/ignore_keys.rb +1 -0
- data/lib/i18n/tasks/key_pattern_matching.rb +1 -0
- data/lib/i18n/tasks/locale_list.rb +1 -0
- data/lib/i18n/tasks/locale_pathname.rb +1 -0
- data/lib/i18n/tasks/logging.rb +5 -6
- data/lib/i18n/tasks/missing_keys.rb +1 -0
- data/lib/i18n/tasks/plural_keys.rb +1 -0
- data/lib/i18n/tasks/rainbow_utils.rb +15 -0
- data/lib/i18n/tasks/references.rb +1 -0
- data/lib/i18n/tasks/reports/base.rb +1 -0
- data/lib/i18n/tasks/reports/spreadsheet.rb +2 -1
- data/lib/i18n/tasks/reports/terminal.rb +33 -31
- data/lib/i18n/tasks/scanners/file_scanner.rb +1 -0
- data/lib/i18n/tasks/scanners/files/caching_file_finder.rb +1 -0
- data/lib/i18n/tasks/scanners/files/caching_file_finder_provider.rb +1 -0
- data/lib/i18n/tasks/scanners/files/caching_file_reader.rb +1 -0
- data/lib/i18n/tasks/scanners/files/file_finder.rb +1 -0
- data/lib/i18n/tasks/scanners/files/file_reader.rb +1 -0
- data/lib/i18n/tasks/scanners/occurrence_from_position.rb +1 -0
- data/lib/i18n/tasks/scanners/pattern_mapper.rb +1 -0
- data/lib/i18n/tasks/scanners/pattern_scanner.rb +1 -0
- data/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb +1 -0
- data/lib/i18n/tasks/scanners/relative_keys.rb +1 -0
- data/lib/i18n/tasks/scanners/results/key_occurrences.rb +1 -0
- data/lib/i18n/tasks/scanners/results/occurrence.rb +1 -0
- data/lib/i18n/tasks/scanners/ruby_ast_call_finder.rb +1 -0
- data/lib/i18n/tasks/scanners/ruby_ast_scanner.rb +3 -2
- data/lib/i18n/tasks/scanners/ruby_key_literals.rb +1 -0
- data/lib/i18n/tasks/scanners/scanner.rb +1 -0
- data/lib/i18n/tasks/scanners/scanner_multiplexer.rb +1 -0
- data/lib/i18n/tasks/split_key.rb +1 -0
- data/lib/i18n/tasks/stats.rb +1 -0
- data/lib/i18n/tasks/string_interpolation.rb +1 -0
- data/lib/i18n/tasks/unused_keys.rb +3 -2
- data/lib/i18n/tasks/used_keys.rb +3 -2
- data/lib/i18n/tasks/version.rb +2 -1
- data/templates/rspec/i18n_spec.rb +1 -0
- metadata +9 -8
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'i18n/tasks/scanners/file_scanner'
|
3
4
|
require 'i18n/tasks/scanners/relative_keys'
|
4
5
|
require 'i18n/tasks/scanners/ruby_ast_call_finder'
|
@@ -40,7 +41,7 @@ module I18n::Tasks::Scanners
|
|
40
41
|
# transform_values is only available in ActiveSupport 4.2+
|
41
42
|
h.each { |k, v| h[k] = v.first }
|
42
43
|
end.invert
|
43
|
-
results + magic_comments.flat_map do |comment|
|
44
|
+
results + (magic_comments.flat_map do |comment|
|
44
45
|
@parser.reset
|
45
46
|
associated_node = comment_to_node[comment]
|
46
47
|
@call_finder.collect_calls(
|
@@ -49,7 +50,7 @@ module I18n::Tasks::Scanners
|
|
49
50
|
# method_name is not available at this stage
|
50
51
|
send_node_to_key_occurrence(send_node, nil, location: associated_node || comment.location)
|
51
52
|
end
|
52
|
-
end
|
53
|
+
end)
|
53
54
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
54
55
|
raise ::I18n::Tasks::CommandError.new(e, "Error scanning #{path}: #{e.message}")
|
55
56
|
end
|
data/lib/i18n/tasks/split_key.rb
CHANGED
data/lib/i18n/tasks/stats.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'set'
|
3
4
|
|
4
5
|
module I18n
|
@@ -13,11 +14,11 @@ module I18n
|
|
13
14
|
# @param [Boolean] strict if true, do not match dynamic keys
|
14
15
|
def unused_tree(locale: base_locale, strict: nil)
|
15
16
|
used_key_names = used_tree(strict: true).key_names
|
16
|
-
collapse_plural_nodes!
|
17
|
+
collapse_plural_nodes!(data[locale].select_keys do |key, _node|
|
17
18
|
!ignore_key?(key, :unused) &&
|
18
19
|
(strict || !used_in_expr?(key)) &&
|
19
20
|
!used_key_names.include?(depluralize_key(key, locale))
|
20
|
-
|
21
|
+
end)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
data/lib/i18n/tasks/used_keys.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'find'
|
3
4
|
require 'i18n/tasks/scanners/pattern_with_scope_scanner'
|
4
5
|
require 'i18n/tasks/scanners/ruby_ast_scanner'
|
@@ -56,7 +57,7 @@ module I18n::Tasks
|
|
56
57
|
scanner(strict: strict).keys.freeze)
|
57
58
|
if key_filter
|
58
59
|
key_filter_re = compile_key_pattern(key_filter)
|
59
|
-
keys = keys.
|
60
|
+
keys = keys.select { |k| k.key =~ key_filter_re }
|
60
61
|
end
|
61
62
|
Data::Tree::Node.new(
|
62
63
|
key: 'used',
|
@@ -128,7 +129,7 @@ module I18n::Tasks
|
|
128
129
|
|
129
130
|
# @return [Boolean] whether the key is potentially used in a code expression such as `t("category.#{category_key}")`
|
130
131
|
def used_in_expr?(key)
|
131
|
-
!!(key =~ expr_key_re) # rubocop:disable Style/DoubleNegation
|
132
|
+
!!(key =~ expr_key_re) # rubocop:disable Style/DoubleNegation,Style/InverseMethods
|
132
133
|
end
|
133
134
|
|
134
135
|
private
|
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.13
|
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-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -109,19 +109,19 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 2.2.3.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rainbow
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: '2.2'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '2.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: terminal-table
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -298,6 +298,7 @@ files:
|
|
298
298
|
- lib/i18n/tasks/logging.rb
|
299
299
|
- lib/i18n/tasks/missing_keys.rb
|
300
300
|
- lib/i18n/tasks/plural_keys.rb
|
301
|
+
- lib/i18n/tasks/rainbow_utils.rb
|
301
302
|
- lib/i18n/tasks/references.rb
|
302
303
|
- lib/i18n/tasks/reports/base.rb
|
303
304
|
- lib/i18n/tasks/reports/spreadsheet.rb
|
@@ -353,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
353
354
|
version: '0'
|
354
355
|
requirements: []
|
355
356
|
rubyforge_project:
|
356
|
-
rubygems_version: 2.6.
|
357
|
+
rubygems_version: 2.6.11
|
357
358
|
signing_key:
|
358
359
|
specification_version: 4
|
359
360
|
summary: Manage localization and translation with the awesome power of static analysis
|