i18n-tasks 0.7.13 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +11 -0
  3. data/Gemfile +5 -3
  4. data/README.md +27 -126
  5. data/bin/i18n-tasks +2 -45
  6. data/config/locales/en.yml +11 -14
  7. data/config/locales/ru.yml +0 -3
  8. data/i18n-tasks.gemspec +0 -1
  9. data/lib/i18n/tasks.rb +14 -2
  10. data/lib/i18n/tasks/cli.rb +195 -0
  11. data/lib/i18n/tasks/command/collection.rb +2 -2
  12. data/lib/i18n/tasks/command/commander.rb +4 -24
  13. data/lib/i18n/tasks/command/commands/data.rb +17 -19
  14. data/lib/i18n/tasks/command/commands/eq_base.rb +2 -2
  15. data/lib/i18n/tasks/command/commands/health.rb +2 -2
  16. data/lib/i18n/tasks/command/commands/meta.rb +2 -2
  17. data/lib/i18n/tasks/command/commands/missing.rb +22 -15
  18. data/lib/i18n/tasks/command/commands/tree.rb +31 -35
  19. data/lib/i18n/tasks/command/commands/usages.rb +10 -11
  20. data/lib/i18n/tasks/command/commands/xlsx.rb +3 -3
  21. data/lib/i18n/tasks/command/dsl.rb +22 -7
  22. data/lib/i18n/tasks/command/option_parsers/enum.rb +53 -0
  23. data/lib/i18n/tasks/command/option_parsers/locale.rb +48 -0
  24. data/lib/i18n/tasks/command/options/common.rb +21 -31
  25. data/lib/i18n/tasks/command/options/data.rb +91 -0
  26. data/lib/i18n/tasks/command/options/locales.rb +22 -42
  27. data/lib/i18n/tasks/data/file_system_base.rb +2 -2
  28. data/lib/i18n/tasks/data/tree/node.rb +3 -3
  29. data/lib/i18n/tasks/data/tree/nodes.rb +3 -2
  30. data/lib/i18n/tasks/data/tree/siblings.rb +0 -1
  31. data/lib/i18n/tasks/logging.rb +9 -5
  32. data/lib/i18n/tasks/scanners/base_scanner.rb +6 -7
  33. data/lib/i18n/tasks/scanners/relative_keys.rb +1 -1
  34. data/lib/i18n/tasks/version.rb +1 -1
  35. data/spec/commands/data_commands_spec.rb +4 -4
  36. data/spec/commands/tree_commands_spec.rb +5 -5
  37. data/spec/google_translate_spec.rb +2 -3
  38. data/spec/i18n_spec.rb +0 -1
  39. data/spec/i18n_tasks_spec.rb +44 -23
  40. data/spec/readme_spec.rb +1 -1
  41. data/spec/support/test_codebase.rb +21 -10
  42. data/templates/config/i18n-tasks.yml +51 -39
  43. data/templates/rspec/i18n_spec.rb +0 -1
  44. metadata +6 -23
  45. data/lib/i18n/tasks/command/dsl/cmd.rb +0 -19
  46. data/lib/i18n/tasks/command/dsl/cmd_opt.rb +0 -19
  47. data/lib/i18n/tasks/command/dsl/enum_opt.rb +0 -45
  48. data/lib/i18n/tasks/command/options/enum_opt.rb +0 -50
  49. data/lib/i18n/tasks/command/options/list_opt.rb +0 -11
  50. data/lib/i18n/tasks/command/options/trees.rb +0 -81
  51. data/lib/i18n/tasks/slop_command.rb +0 -41
@@ -11,7 +11,7 @@ module I18n
11
11
  path_root(normalized_path, roots) or
12
12
  raise CommandError.new(
13
13
  "Error scanning #{normalized_path}: cannot resolve relative key
14
- \"#{key}\".\nSet relative_roots in config/i18n-tasks.yml
14
+ \"#{key}\".\nSet search.relative_roots in config/i18n-tasks.yml
15
15
  (currently #{relative_roots.inspect})"
16
16
  )
17
17
 
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
  module I18n
3
3
  module Tasks
4
- VERSION = '0.7.13'
4
+ VERSION = '0.8.0'
5
5
  end
6
6
  end
@@ -20,19 +20,19 @@ describe 'Data commands' do
20
20
  end
21
21
 
22
22
  it '#data' do
23
- expect(JSON.parse(run_cmd :data, format: 'json', locales: 'en')).to eq(en_data)
23
+ expect(JSON.parse(run_cmd 'data', '-fjson', '-len')).to eq(en_data)
24
24
  end
25
25
 
26
26
  it '#data-merge' do
27
- expect(JSON.parse(run_cmd :data_merge, format: 'json', arguments: [en_data_2.to_json], nostdin: true)).to eq(en_data.deep_merge en_data_2)
27
+ expect(JSON.parse(run_cmd 'data-merge', '-fjson', '-S', en_data_2.to_json)).to eq(en_data.deep_merge en_data_2)
28
28
  end
29
29
 
30
30
  it '#data-write' do
31
- expect(JSON.parse(run_cmd :data_write, format: 'json', arguments: [en_data_2.to_json])).to eq(en_data_2)
31
+ expect(JSON.parse(run_cmd 'data-write', '-fjson', '-S', en_data_2.to_json)).to eq(en_data_2)
32
32
  end
33
33
 
34
34
  it '#data-remove' do
35
35
  to_remove = {'en' => {'common' => {'hello' => ''}}}
36
- expect(JSON.parse(run_cmd :data_remove, format: 'json', arguments: [to_remove.to_json])).to eq('en' => {'common' => en_data['en']['common'] })
36
+ expect(JSON.parse(run_cmd 'data-remove', '-fjson', '-S', to_remove.to_json)).to eq('en' => {'common' => en_data['en']['common'] })
37
37
  end
38
38
  end
@@ -13,7 +13,7 @@ describe 'Tree commands' do
13
13
  context 'tree-merge' do
14
14
  trees = [{'a' => '1', 'b' => '2'}, {'a' => '-1', 'c' => '3'}]
15
15
  it trees.map(&:to_json).join(', ') do
16
- merged = JSON.parse run_cmd(:tree_merge, format: 'json', arguments: trees.map(&:to_json), nostdin: true)
16
+ merged = JSON.parse run_cmd('tree-merge', '-fjson', '-S', *trees.map(&:to_json))
17
17
  expect(merged).to eq trees.reduce(:merge)
18
18
  end
19
19
  end
@@ -22,7 +22,7 @@ describe 'Tree commands' do
22
22
  forest = {'a' => '1', 'b' => '2', 'c' => {'a' => '3'}}
23
23
  pattern = '{a,c.*}'
24
24
  it "-p #{pattern.inspect} #{forest.to_json}" do
25
- selected = JSON.parse run_cmd(:tree_filter, format: 'json', pattern: pattern, arguments: [forest.to_json])
25
+ selected = JSON.parse run_cmd('tree-filter', '-fjson', '-p', pattern, forest.to_json)
26
26
  expect(selected).to eq(forest.except('b'))
27
27
  end
28
28
  end
@@ -30,7 +30,7 @@ describe 'Tree commands' do
30
30
  context 'tree-subtract' do
31
31
  trees = [{'a' => '1', 'b' => '2'}, {'a' => '-1', 'c' => '3'}]
32
32
  it trees.map(&:to_json).join(' - ') do
33
- subtracted = JSON.parse run_cmd(:tree_subtract, format: 'json', arguments: trees.map(&:to_json), nostdin: true)
33
+ subtracted = JSON.parse run_cmd('tree-subtract', '-fjson', '-S', *trees.map(&:to_json))
34
34
  expected = {'b' => '2'}
35
35
  expect(subtracted).to eq expected
36
36
  end
@@ -42,7 +42,7 @@ describe 'Tree commands' do
42
42
  end
43
43
 
44
44
  def rename_key(from, to)
45
- JSON.parse run_cmd(:tree_rename_key, key: from, name: to, format: 'json', arguments: [forest.to_json])
45
+ JSON.parse run_cmd('tree-rename-key', '-fjson', '-k', from, '-n', to, forest.to_json)
46
46
  end
47
47
 
48
48
  it 'renames root node' do
@@ -62,7 +62,7 @@ describe 'Tree commands' do
62
62
  end
63
63
 
64
64
  it 'converts to keys' do
65
- keys = run_cmd(:tree_convert, from: 'json', to: 'keys', arguments: [forest.to_json]).split("\n")
65
+ keys = run_cmd('tree-convert', '-fjson', '-tkeys', forest.to_json).split("\n")
66
66
  expect(keys.sort).to eq(['a.b.a', 'x'].sort)
67
67
  end
68
68
  end
@@ -15,7 +15,7 @@ describe 'Google Translation' do
15
15
 
16
16
  if ENV['GOOGLE_TRANSLATE_API_KEY']
17
17
  describe 'real world test' do
18
- delegate :i18n_cmd, :i18n_task, :in_test_app_dir, to: :TestCodebase
18
+ delegate :i18n_task, :in_test_app_dir, :run_cmd, to: :TestCodebase
19
19
 
20
20
  context '#google_translate_list' do
21
21
  it "works with #{tests.map(&:first)}" do
@@ -36,7 +36,6 @@ describe 'Google Translation' do
36
36
 
37
37
  context 'command' do
38
38
  let(:task) { i18n_task }
39
- let(:cmd) { i18n_cmd(task) }
40
39
 
41
40
  it 'works' do
42
41
  in_test_app_dir do
@@ -56,7 +55,7 @@ describe 'Google Translation' do
56
55
  }
57
56
  })
58
57
 
59
- cmd.run :translate_missing
58
+ run_cmd 'translate-missing'
60
59
  expect(task.t('common.hello', 'es')).to eq(text_test[2])
61
60
  expect(task.t('common.hello_html', 'es')).to eq(html_test[2])
62
61
  expect(task.t('common.array_key', 'es')).to eq(array_test[2])
data/spec/i18n_spec.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  require 'i18n/tasks'
3
2
 
4
3
  describe 'I18n' do
@@ -1,16 +1,38 @@
1
1
  # coding: utf-8
2
2
  require 'spec_helper'
3
3
  require 'fileutils'
4
+ require 'open3'
4
5
 
6
+ # Integration tests
5
7
  describe 'i18n-tasks' do
6
- delegate :run_cmd, :i18n_task, :in_test_app_dir, :i18n_cmd, to: :TestCodebase
8
+ delegate :run_cmd, :run_cmd_capture_stderr, :i18n_task, :in_test_app_dir, to: :TestCodebase
9
+
10
+ describe 'bin/i18n-tasks' do
11
+ it 'shows help when invoked with no arguments, shows version on --version' do
12
+ # These bin/i18n-tasks tests are executed in parallel for performance
13
+ [
14
+ proc {
15
+ out, err, status = Open3.capture3('bin/i18n-tasks')
16
+ expect(status).to be_success
17
+ expect(out).to be_empty
18
+ expect(err).to start_with('Usage: i18n-tasks [command] [options]')
19
+ expect(err).to include('Available commands', 'add-missing')
20
+ },
21
+ proc {
22
+ expect(%x[bin/i18n-tasks --version].chomp).to eq(I18n::Tasks::VERSION)
23
+ }
24
+ ].map { |test| Thread.start(&test) }.each(&:join)
25
+ end
26
+ end
27
+
28
+ # Tests execute i18n-tasks using I18n::Tasks::CLI directly, via #run_cmd(task, *arguments).
29
+ # This avoid launching a process for each command.
7
30
 
8
31
  describe 'health' do
9
32
  it 'outputs stats' do
10
33
  t = i18n_task
11
- stats = in_test_app_dir { t.forest_stats(t.data_forest t.locales) }
12
- out = in_test_app_dir { capture_stderr { capture_stdout { i18n_cmd.run(:health) } } }
13
- stats.values.each do |v|
34
+ out = run_cmd_capture_stderr('health')
35
+ in_test_app_dir { t.forest_stats(t.data_forest t.locales) }.values.each do |v|
14
36
  expect(out).to include(v.to_s)
15
37
  end
16
38
  end
@@ -38,16 +60,16 @@ describe 'i18n-tasks' do
38
60
  }
39
61
  it 'detects missing' do
40
62
  es_keys = expected_missing_keys.grep(/^es\./)
41
- expect(run_cmd :missing).to be_i18n_keys expected_missing_keys
63
+ expect(run_cmd 'missing').to be_i18n_keys expected_missing_keys
42
64
  # locale argument
43
- expect(run_cmd :missing, locales: %w(es)).to be_i18n_keys es_keys
44
- expect(run_cmd :missing, arguments: %w(es)).to be_i18n_keys es_keys
65
+ expect(run_cmd 'missing', '-les').to be_i18n_keys es_keys
66
+ expect(run_cmd 'missing', 'es').to be_i18n_keys es_keys
45
67
  end
46
68
  end
47
69
 
48
70
  describe 'eq_base' do
49
- it 'detects eq_base' do
50
- expect(run_cmd :eq_base).to be_i18n_keys %w(es.same_in_es.a)
71
+ it 'detects eq-base' do
72
+ expect(run_cmd 'eq-base').to be_i18n_keys %w(es.same_in_es.a)
51
73
  end
52
74
  end
53
75
 
@@ -65,11 +87,11 @@ describe 'i18n-tasks' do
65
87
 
66
88
  describe 'unused' do
67
89
  it 'detects unused' do
68
- expect(run_cmd :unused).to be_i18n_keys expected_unused_keys
90
+ expect(run_cmd 'unused').to be_i18n_keys expected_unused_keys
69
91
  end
70
92
 
71
93
  it 'detects unused (--strict)' do
72
- expect(run_cmd :unused, strict: true).to be_i18n_keys expected_unused_keys_strict
94
+ expect(run_cmd 'unused', '--strict').to be_i18n_keys expected_unused_keys_strict
73
95
  end
74
96
  end
75
97
 
@@ -83,7 +105,7 @@ describe 'i18n-tasks' do
83
105
  expect(t.key_value?(key, :es)).to be true
84
106
  end
85
107
  ENV['CONFIRM'] = '1'
86
- run_cmd :remove_unused
108
+ run_cmd 'remove-unused'
87
109
  t.data.reload
88
110
  unused.each do |key|
89
111
  expect(t.key_value?(key, :en)).to be false
@@ -96,7 +118,7 @@ describe 'i18n-tasks' do
96
118
  describe 'normalize' do
97
119
  it 'sorts the keys' do
98
120
  in_test_app_dir do
99
- run_cmd :normalize
121
+ run_cmd 'normalize'
100
122
  en_yml_data = i18n_task.data.reload['en'].select_keys { |_k, node|
101
123
  node.data[:path] == 'config/locales/en.yml'
102
124
  }
@@ -112,7 +134,7 @@ describe 'i18n-tasks' do
112
134
  it 'moves keys to the corresponding files as per data.write' do
113
135
  in_test_app_dir {
114
136
  expect(File).to_not exist 'config/locales/devise.en.yml'
115
- run_cmd :normalize, pattern_router: true
137
+ run_cmd 'normalize', '--pattern_router'
116
138
  expect(YAML.load_file('config/locales/devise.en.yml')['en']['devise']['a']).to eq 'EN_TEXT'
117
139
  }
118
140
  end
@@ -121,7 +143,7 @@ describe 'i18n-tasks' do
121
143
  describe 'xlsx_report' do
122
144
  it 'saves' do
123
145
  in_test_app_dir {
124
- run_cmd :xlsx_report
146
+ run_cmd 'xlsx-report'
125
147
  expect(File).to exist 'tmp/i18n-report.xlsx'
126
148
  FileUtils.cp('tmp/i18n-report.xlsx', '..')
127
149
  }
@@ -134,7 +156,7 @@ describe 'i18n-tasks' do
134
156
  in_test_app_dir {
135
157
  expect(YAML.load_file('config/locales/en.yml')['en']['used_but_missing']).to be_nil
136
158
  }
137
- run_cmd :add_missing, locales: 'base'
159
+ run_cmd 'add-missing', 'base'
138
160
  in_test_app_dir {
139
161
  expect(YAML.load_file('config/locales/en.yml')['en']['used_but_missing']['key']).to eq I18n.t('i18n_tasks.common.key')
140
162
  expect(YAML.load_file('config/locales/en.yml')['en']['present_in_es_but_not_en']['a']).to eq 'ES_TEXT'
@@ -145,7 +167,7 @@ describe 'i18n-tasks' do
145
167
  in_test_app_dir {
146
168
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']).to be_nil
147
169
  }
148
- run_cmd :add_missing, locales: 'es'
170
+ run_cmd 'add-missing', 'es'
149
171
  in_test_app_dir {
150
172
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']['a']).to eq 'EN_TEXT'
151
173
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es_plural_1']['a']['one']).to eq 'EN_TEXT'
@@ -156,8 +178,8 @@ describe 'i18n-tasks' do
156
178
  in_test_app_dir {
157
179
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']).to be_nil
158
180
  }
159
- run_cmd :normalize, pattern_router: true
160
- run_cmd :add_missing, locales: 'all', value: 'TRME'
181
+ run_cmd 'normalize', '--pattern_router'
182
+ run_cmd 'add-missing', '-v', 'TRME'
161
183
  in_test_app_dir {
162
184
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']['a']).to eq 'TRME'
163
185
  expect(YAML.load_file('config/locales/devise.es.yml')['es']['devise']['a']).to eq 'ES_TEXT'
@@ -169,7 +191,7 @@ describe 'i18n-tasks' do
169
191
  in_test_app_dir {
170
192
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']).to be_nil
171
193
  }
172
- run_cmd :add_missing, locales: 'all', value: 'TRME %{value}'
194
+ run_cmd 'add-missing', '-v', 'TRME %{value}'
173
195
  in_test_app_dir {
174
196
  expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']['a']).to eq 'TRME EN_TEXT'
175
197
  expect(YAML.load_file('config/locales/en.yml')['en']['present_in_es_but_not_en']['a']).to eq 'TRME ES_TEXT'
@@ -179,7 +201,7 @@ describe 'i18n-tasks' do
179
201
 
180
202
  describe 'config' do
181
203
  it 'prints config' do
182
- expect(YAML.load(Term::ANSIColor.uncolor(run_cmd :config))).to(
204
+ expect(YAML.load(Term::ANSIColor.uncolor(run_cmd 'config'))).to(
183
205
  eq(in_test_app_dir { i18n_task.config_for_inspect })
184
206
  )
185
207
  end
@@ -187,7 +209,7 @@ describe 'i18n-tasks' do
187
209
 
188
210
  describe 'find' do
189
211
  it 'prints usages' do
190
- result = Term::ANSIColor.uncolor(run_cmd :find, arguments: ['used.*'])
212
+ result = Term::ANSIColor.uncolor(run_cmd 'find', 'used.*')
191
213
  expect(result).to eq(<<-TXT)
192
214
  used.a 2
193
215
  app/views/usages.html.slim:1 p = t 'used.a'
@@ -196,7 +218,6 @@ used.a 2
196
218
  end
197
219
  end
198
220
 
199
-
200
221
  # --- setup ---
201
222
  BENCH_KEYS = ENV['BENCH_KEYS'].to_i
202
223
  before(:each) do
data/spec/readme_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
- require 'spec_helper'
2
+
3
3
  describe 'README.md' do
4
4
  let(:readme) { File.read('README.md', encoding: 'UTF-8') }
5
5
  it 'has valid YAML in ```yaml blocks' do
@@ -3,6 +3,7 @@ require 'fileutils'
3
3
  require 'yaml'
4
4
  require_relative 'capture_std'
5
5
  require 'i18n/tasks/commands'
6
+ require 'i18n/tasks/cli'
6
7
 
7
8
  module TestCodebase
8
9
  include CaptureStd
@@ -10,19 +11,29 @@ module TestCodebase
10
11
  AT = 'tmp/test_codebase'
11
12
 
12
13
  def i18n_task(*args)
13
- TestCodebase.in_test_app_dir do
14
+ in_test_app_dir do
14
15
  ::I18n::Tasks::BaseTask.new(*args)
15
16
  end
16
17
  end
17
18
 
18
- def i18n_cmd(*args)
19
- TestCodebase.in_test_app_dir do
20
- ::I18n::Tasks::Commands.new(*args)
21
- end
19
+ def run_cmd(name, *args)
20
+ capture_stdout { capture_stderr { in_test_app_dir {
21
+ run_cli(name, *args)
22
+ } } }
23
+ end
24
+
25
+ def run_cmd_capture_stderr(name, *args)
26
+ capture_stderr { capture_stdout { in_test_app_dir {
27
+ run_cli(name, *args)
28
+ } } }
29
+ end
30
+
31
+ def run_cli(name, *args)
32
+ i18n_cli.run([name, *args])
22
33
  end
23
34
 
24
- def run_cmd(name, *args, &block)
25
- in_test_app_dir { capture_stdout { capture_stderr { i18n_cmd.run(name, *args, &block) } } }
35
+ def i18n_cli
36
+ in_test_app_dir { ::I18n::Tasks::CLI.new }
26
37
  end
27
38
 
28
39
  def setup(files = {})
@@ -47,13 +58,13 @@ module TestCodebase
47
58
  }
48
59
  end
49
60
 
50
- def in_test_app_dir(&block)
51
- return block.call if @in_dir
61
+ def in_test_app_dir
62
+ return yield if @in_dir
52
63
  begin
53
64
  pwd = Dir.pwd
54
65
  Dir.chdir AT
55
66
  @in_dir = true
56
- block.call
67
+ yield
57
68
  ensure
58
69
  Dir.chdir pwd
59
70
  @in_dir = false
@@ -1,75 +1,87 @@
1
- # i18n-tasks finds and manages missing and unused translations https://github.com/glebm/i18n-tasks
1
+ # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
2
 
3
+ # The "main" locale.
3
4
  base_locale: en
4
- ## i18n-tasks detects locales automatically from the existing locale files
5
- ## uncomment to set locales explicitly
6
- # locales: [en, es, fr]
5
+ ## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
6
+ # locales: [es, fr]
7
+ ## Reporting locale, default: en. Available: en, ru.
8
+ # internal_locale: en
7
9
 
8
- ## i18n-tasks report locale, default: en, available: en, ru
9
- # internal_locale: ru
10
-
11
- # Read and write locale data
10
+ # Read and write translations.
12
11
  data:
13
- ## by default, translation data are read from the file system, or you can provide a custom data adapter
12
+ ## Translations are read from the file system. Supported format: YAML, JSON.
13
+ ## Provide a custom adapter:
14
14
  # adapter: I18n::Tasks::Data::FileSystem
15
15
 
16
- # Locale files to read from
16
+ # Locale files or `File.find` patterns where translations are read from:
17
17
  read:
18
- - config/locales/%{locale}.yml
19
- # - config/locales/*.%{locale}.yml
18
+ ## Default:
19
+ # - config/locales/%{locale}.yml
20
+ ## More files:
20
21
  # - config/locales/**/*.%{locale}.yml
22
+ ## Another gem:
23
+ # - "<%= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
21
24
 
22
- # key => file routes, matched top to bottom
25
+ # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
26
+ # `i18n-tasks normalize -p` will force move the keys according to these rules
23
27
  write:
24
- ## E.g., write devise and simple form keys to their respective files
28
+ ## For example, write devise and simple form keys to their respective files:
25
29
  # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
26
- # Catch-all
27
- - config/locales/%{locale}.yml
28
- # `i18n-tasks normalize -p` will force move the keys according to these rules
30
+ ## Catch-all default:
31
+ # - config/locales/%{locale}.yml
32
+
33
+ ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
34
+ # router: convervative_router
29
35
 
30
- # YAML / JSON serializer options, passed to load / dump / parse / serialize
31
36
  yaml:
32
37
  write:
33
38
  # do not wrap lines at 80 characters
34
39
  line_width: -1
35
- json:
36
- write:
37
- # pretty print JSON
38
- indent: ' '
39
- space: ' '
40
- object_nl: "\n"
41
- array_nl: "\n"
40
+
41
+ ## Pretty-print JSON:
42
+ # json:
43
+ #
44
+ # write:
45
+ # indent: ' '
46
+ # space: ' '
47
+ # object_nl: "\n"
48
+ # array_nl: "\n"
42
49
 
43
50
  # Find translate calls
44
51
  search:
45
- ## Default scanner finds t() and I18n.t() calls
46
- # scanner: I18n::Tasks::Scanners::PatternWithScopeScanner
47
-
48
- ## Paths to search in, passed to File.find
49
- paths:
50
- - app/
52
+ ## Paths or `File.find` patterns to search in:
53
+ # paths:
54
+ # - app/
51
55
 
52
- ## Root for resolving relative keys (default)
56
+ ## Root directories for relative keys resolution.
53
57
  # relative_roots:
54
58
  # - app/views
59
+ # - app/controllers
60
+ # - app/helpers
61
+ # - app/presenters
55
62
 
56
- ## File.fnmatch patterns to exclude from search (default)
57
- # exclude: ["*.jpg", "*.png", "*.gif", "*.svg", "*.ico", "*.eot", "*.ttf", "*.woff", "*.pdf"]
63
+ ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
64
+ ## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
65
+ # exclude: []
58
66
 
59
- ## Or, File.fnmatch patterns to include
67
+ ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
68
+ ## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
60
69
  # include: ["*.rb", "*.html.slim"]
61
70
 
71
+ ## Default scanner finds t() and I18n.t() calls.
72
+ # scanner: I18n::Tasks::Scanners::PatternWithScopeScanner
73
+
62
74
  ## Google Translate
63
75
  # translation:
64
76
  # # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
65
77
  # api_key: "AbC-dEf5"
66
78
 
67
- ## Consider these keys not missing
79
+ ## Do not consider these keys missing:
68
80
  # ignore_missing:
69
81
  # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
70
82
  # - '{devise,simple_form}.*'
71
83
 
72
- ## Consider these keys used
84
+ ## Consider these keys used:
73
85
  # ignore_unused:
74
86
  # - 'activerecord.attributes.*'
75
87
  # - '{devise,kaminari,will_paginate}.*'
@@ -77,13 +89,13 @@ search:
77
89
  # - 'simple_form.{placeholders,hints,labels}.*'
78
90
  # - 'simple_form.{error_notification,required}.:'
79
91
 
80
- ## Exclude these keys from `i18n-tasks eq-base' report
92
+ ## Exclude these keys from the `i18n-tasks eq-base' report:
81
93
  # ignore_eq_base:
82
94
  # all:
83
95
  # - common.ok
84
96
  # fr,es:
85
97
  # - common.brand
86
98
 
87
- ## Exclude these keys from all of the reports
99
+ ## Ignore these keys completely:
88
100
  # ignore:
89
101
  # - kaminari.*