i18n-tasks 0.6.3 → 0.7.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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/Gemfile +2 -1
  4. data/README.md +80 -78
  5. data/bin/i18n-tasks +24 -30
  6. data/config/i18n-tasks.yml +87 -0
  7. data/config/locales/en.yml +95 -0
  8. data/i18n-tasks.gemspec +1 -0
  9. data/lib/i18n/tasks.rb +10 -0
  10. data/lib/i18n/tasks/base_task.rb +6 -2
  11. data/lib/i18n/tasks/command/collection.rb +18 -0
  12. data/lib/i18n/tasks/command/commander.rb +72 -0
  13. data/lib/i18n/tasks/command/commands/data.rb +73 -0
  14. data/lib/i18n/tasks/command/commands/eq_base.rb +20 -0
  15. data/lib/i18n/tasks/command/commands/health.rb +26 -0
  16. data/lib/i18n/tasks/command/commands/meta.rb +35 -0
  17. data/lib/i18n/tasks/command/commands/missing.rb +73 -0
  18. data/lib/i18n/tasks/command/commands/tree.rb +92 -0
  19. data/lib/i18n/tasks/command/commands/usages.rb +70 -0
  20. data/lib/i18n/tasks/command/commands/xlsx.rb +27 -0
  21. data/lib/i18n/tasks/command/dsl.rb +27 -0
  22. data/lib/i18n/tasks/command/dsl/cmd.rb +19 -0
  23. data/lib/i18n/tasks/command/dsl/cmd_opt.rb +19 -0
  24. data/lib/i18n/tasks/command/dsl/enum_opt.rb +26 -0
  25. data/lib/i18n/tasks/command/options/common.rb +48 -0
  26. data/lib/i18n/tasks/command/options/enum_opt.rb +44 -0
  27. data/lib/i18n/tasks/command/options/list_opt.rb +11 -0
  28. data/lib/i18n/tasks/command/options/locales.rb +47 -0
  29. data/lib/i18n/tasks/command/options/trees.rb +101 -0
  30. data/lib/i18n/tasks/command_error.rb +3 -0
  31. data/lib/i18n/tasks/commands.rb +22 -169
  32. data/lib/i18n/tasks/configuration.rb +1 -16
  33. data/lib/i18n/tasks/console_context.rb +1 -1
  34. data/lib/i18n/tasks/data.rb +13 -8
  35. data/lib/i18n/tasks/data/file_formats.rb +29 -18
  36. data/lib/i18n/tasks/data/file_system_base.rb +35 -4
  37. data/lib/i18n/tasks/data/router/conservative_router.rb +18 -11
  38. data/lib/i18n/tasks/data/tree/node.rb +5 -15
  39. data/lib/i18n/tasks/data/tree/nodes.rb +0 -3
  40. data/lib/i18n/tasks/data/tree/siblings.rb +32 -2
  41. data/lib/i18n/tasks/data/tree/traversal.rb +117 -96
  42. data/lib/i18n/tasks/google_translation.rb +25 -25
  43. data/lib/i18n/tasks/html_keys.rb +10 -0
  44. data/lib/i18n/tasks/key_pattern_matching.rb +1 -0
  45. data/lib/i18n/tasks/locale_list.rb +19 -0
  46. data/lib/i18n/tasks/missing_keys.rb +32 -33
  47. data/lib/i18n/tasks/plural_keys.rb +1 -1
  48. data/lib/i18n/tasks/reports/base.rb +4 -9
  49. data/lib/i18n/tasks/reports/spreadsheet.rb +5 -5
  50. data/lib/i18n/tasks/reports/terminal.rb +62 -38
  51. data/lib/i18n/tasks/scanners/base_scanner.rb +5 -4
  52. data/lib/i18n/tasks/slop_command.rb +27 -0
  53. data/lib/i18n/tasks/stats.rb +20 -0
  54. data/lib/i18n/tasks/string_interpolation.rb +14 -0
  55. data/lib/i18n/tasks/unused_keys.rb +0 -10
  56. data/lib/i18n/tasks/version.rb +1 -1
  57. data/spec/commands/data_commands_spec.rb +38 -0
  58. data/spec/commands/tree_commands_spec.rb +68 -0
  59. data/spec/fixtures/app/views/index.html.slim +1 -0
  60. data/spec/google_translate_spec.rb +5 -3
  61. data/spec/i18n_spec.rb +18 -0
  62. data/spec/i18n_tasks_spec.rb +8 -8
  63. data/spec/spec_helper.rb +3 -3
  64. data/spec/support/test_codebase.rb +4 -1
  65. data/spec/used_keys_spec.rb +7 -7
  66. data/templates/config/i18n-tasks.yml +2 -2
  67. metadata +48 -4
  68. data/lib/i18n/tasks/commands_base.rb +0 -107
  69. data/lib/i18n/tasks/fill_tasks.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b615d3bad6d043fd662de2ba05caba8230ab6d5a
4
- data.tar.gz: 0e16ff6699e70fa0ac00aecddfe674d9e56d4352
3
+ metadata.gz: b7b2e4af8b66aed1ff33eba3cb802322ceea57db
4
+ data.tar.gz: 951337877ce07c613b5765b609dd0c3508742a89
5
5
  SHA512:
6
- metadata.gz: 613137fe779a345d90bafec320ed973e16823e460b2a772bf947ac4e885aae87391e311133842b9d78de69945942214a67bc92151b3e66c6e02fb622bd01e7fc
7
- data.tar.gz: 9f7b694d7c4c012d19935089311b87809fbe6279e0184bd1d4b8619e10336de5afca4539c111dbd610bb8786965d890b2eaf4374bc985afb8572702f81ea1fc3
6
+ metadata.gz: 8b04b6fbabcd0598b2473162142679e81ef5eec9301c3c9362bc44a81084517fbf8d254c1015b0b5dc5365261730550c1356db3cc7d57e56a78ff3a85be1e471
7
+ data.tar.gz: 2ecb5edaa048079936459dc1f8d607aafe441abb352e7ee0e8585c1a5e251336d8206cc0e7840a3a95a84de78963baafd181a46f779120322ef5736466bfbb35
data/.travis.yml CHANGED
@@ -8,4 +8,7 @@ rvm:
8
8
  env:
9
9
  global:
10
10
  - TRAVIS=1
11
+ # google translate api key:
11
12
  - secure: Clln+r2rG6adnmVjS0zGMVHs1hOq58UPIqRE73xW3MPLOdozGUyIZ0RrAU2new1h4sqk/5HVwG5NSW7AsUJDGgkNCDx4saJbf/G+oKIity1zNxlHZu5ijZOZGyxYNzGGM4cb2OO6RS6lfzA6TFv2TQtw8DDfKjzG2gpuJOje8sU=
13
+ # codeclimate repo token:
14
+ - secure: Qz5xzCujPHN5jGZYiCcsZ73BN5DzJTQwDMuj0kJ+W2nBzGQuQDvADT0rHFsHOhdQ/epZe89pVL8wEbr5GaCZ+iZCt1JfasZpvyvCtwMUkPtjrLxpWwVKlH3u7xqAzyYj7Z8ru0VqHni19d6DPzAaNGyV3gaiI1pR6Y63Ux+msM0=
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'coveralls', require: false
8
7
  gem 'byebug', platform: :mri_21, require: false
9
8
  end
9
+
10
+ gem 'codeclimate-test-reporter', group: :test, require: nil
data/README.md CHANGED
@@ -1,7 +1,14 @@
1
- # i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coveralls]][coveralls] [![Code Climate][badge-code-climate]][code-climate] [![Gemnasium][badge-gemnasium]][gemnasium]
1
+ # i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coverage]][coverage] [![Code Climate][badge-code-climate]][code-climate] [![Gemnasium][badge-gemnasium]][gemnasium]
2
2
 
3
3
  i18n-tasks helps you find and manage missing and unused translations.
4
4
 
5
+ ## What?
6
+
7
+ i18n-tasks scans calls such as `I18n.t('some.key')` and provides reports on key usage, missing, and unused keys.
8
+ i18n-tasks can also can pre-fill missing keys, including from Google Translate, and it can remove unused keys as well.
9
+
10
+ ## Why?
11
+
5
12
  The default approach to locale data management with gems such as [i18n][i18n-gem] is flawed.
6
13
  If you use a key that does not exist, this will only blow up at runtime. Keys left over from removed code accumulate
7
14
  in the resource files and introduce unnecessary overhead on the translators. Translation files can quickly turn to disarray.
@@ -18,16 +25,16 @@ i18n-tasks can be used with any project using [i18n][i18n-gem] (default in Rails
18
25
  Add to Gemfile:
19
26
 
20
27
  ```ruby
21
- gem 'i18n-tasks', '~> 0.6.3'
28
+ gem 'i18n-tasks', '~> 0.7.0'
22
29
  ```
23
30
 
24
- Copy default [config file](#configuration) (optional):
31
+ Copy default [configuration file](#configuration) (optional):
25
32
 
26
33
  ```console
27
34
  $ cp $(i18n-tasks gem-path)/templates/config/i18n-tasks.yml config/
28
35
  ```
29
36
 
30
- Copy [rspec test](#rspec-integration) (optional):
37
+ Copy rspec test to test for missing and unused translations as part of the suite (optional):
31
38
 
32
39
  ```console
33
40
  $ cp $(i18n-tasks gem-path)/templates/rspec/i18n_spec.rb spec/
@@ -35,96 +42,97 @@ $ cp $(i18n-tasks gem-path)/templates/rspec/i18n_spec.rb spec/
35
42
 
36
43
  ## Usage
37
44
 
38
- Run `i18n-tasks` to get the list of tasks with short descriptions.
45
+ Run `i18n-tasks` to get the list of all the tasks with short descriptions.
39
46
 
40
- ```bash
41
- $ i18n-tasks
42
- Usage: i18n-tasks [command] [options]
43
- -v, --version Print the version
44
- -h, --help Display this help message.
47
+ ### Check health
45
48
 
46
- Available commands:
49
+ `i18n-tasks health` will tell you any keys are missing or not used:
47
50
 
48
- missing show missing translations
49
- unused show unused translations
50
- eq-base show translations equal to base value
51
- find show where the keys are used in the code
52
- data show locale data
53
- translate-missing translate missing keys with Google Translate
54
- add-missing add missing keys to the locales
55
- normalize normalize translation data: sort and move to the right files
56
- remove-unused remove unused keys
57
- config display i18n-tasks configuration
58
- xlsx-report save missing and unused translations to an Excel file
59
- irb REPL session within i18n-tasks context
60
- gem-path show path to the gem
51
+ ```console
52
+ $ i18n-tasks health
53
+ ```
54
+
55
+ ### Add missing keys
61
56
 
62
- See `<command> --help` for more information on a specific command.
57
+ Add missing keys with placeholders (base value or humanized key):
58
+
59
+ ```console
60
+ $ i18n-tasks add-missing
63
61
  ```
64
62
 
65
- Show tasks accept a format option, and all but `find` accept locales as arguments, e.g:
63
+ Most tasks also accept arguments:
66
64
 
67
- ```bash
68
- $ i18n-tasks data --help
69
- Usage: i18n-tasks data [options]
70
- -l, --locales Filter by locale(s), comma-separated list (en,fr) or all (default), or pass arguments without -l
65
+ ```console
66
+ $ i18n-tasks add-missing -v 'TRME %{value}' fr
67
+ $ i18n-tasks add-missing --help
68
+ Usage: i18n-tasks add_missing [options] [locale ...]
69
+ -l, --locales Comma-separated list of locale(s) to process. Default: all. Special: base.
71
70
  -f, --format Output format: terminal-table, yaml, json, keys, inspect. Default: terminal-table.
71
+ -v, --value Value. Interpolates: %{value}, %{human_key}, %{value_or_human_key}. Default: %{value_or_human_key}
72
72
  -h, --help Display this help message.
73
- $ i18n-tasks data -fkeys en es fr
74
73
  ```
75
74
 
76
- #### Add missing keys
77
-
78
- You can add missing values, generated from the key (for base locale) or copied from the base locale (for other locales).
79
- To add missing values to the base locale only:
75
+ `i18n-tasks` also provides low-level composable tasks for fine-grained locale data manipulation. The above is equivalent to:
80
76
 
81
- ```bash
82
- # most task accept locales as first argument. `base` and `all` are special
83
- i18n-tasks add-missing base
84
- # add-missing accepts a placeholder argument, with optional base_value interpolation
85
- i18n-tasks add-missing -p 'PLEASE-TRANSLATE %{base_value}' fr
77
+ ```console
78
+ $ i18n-tasks missing -fyaml fr | i18n-tasks tree-set-value 'TRME %{value}' | i18n-tasks data-merge
86
79
  ```
87
80
 
88
- #### Google Translate missing keys
81
+ See command help for more information.
82
+
83
+ ### Google Translate missing keys
89
84
 
90
85
  Translate missing values with Google Translate ([more below on the API key](#translation-config)).
91
86
 
92
- ```bash
93
- i18n-tasks translate-missing
87
+ ```console
88
+ $ i18n-tasks translate-missing
94
89
  # accepts from and locales options:
95
- i18n-tasks translate-missing --from base es fr
90
+ $ i18n-tasks translate-missing --from base es fr
96
91
  ```
97
92
 
98
- Sort the keys and write them to their respective files with `i18n-tasks normalize`.
99
- This always happens on `i18n-tasks add-missing` and `i18n-tasks translate-missing`.
93
+ ### Find usages
94
+
95
+ See where the keys are used with `i18n-tasks find`:
100
96
 
101
97
  ```bash
102
- i18n-tasks normalize
98
+ $ i18n-tasks find common.help
99
+ $ i18n-tasks find 'auth.*'
100
+ $ i18n-tasks find '{number,currency}.format.*'
103
101
  ```
104
102
 
105
- #### Find usages
103
+ <img width="437" height="129" src="https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-usages.png">
106
104
 
107
- See where the keys are used with `i18n-tasks find`:
105
+ ### Remove unused keys
108
106
 
109
107
  ```bash
110
- i18n-tasks find common.help
111
- i18n-tasks find 'auth.*'
112
- i18n-tasks find '{number,currency}.format.*'
108
+ $ i18n-tasks unused
109
+ $ i18n-tasks remove-unused
113
110
  ```
114
111
 
115
- ![i18n-screenshot][screenshot-find]
112
+ These tasks will infer dynamic key usage such as `t("category.\#{category.name}")` by default.
113
+ Pass `-s` or `--strict` to disable this feature.
116
114
 
117
- ### Find / remove unused keys
115
+ `i18n-tasks remove-unused` is roughly equivalent to:
118
116
 
119
117
  ```bash
120
- i18n-tasks unused
121
- i18n-tasks remove-unused
118
+ $ i18n-tasks unused -fyaml | i18n-tasks data-remove
122
119
  ```
123
120
 
124
- These tasks will infer dynamic key usage such as `t("category.\#{category.name}")` by default.
125
- Pass `-s` or `--strict` to disable this feature.
121
+ ### Normalize data
126
122
 
127
- #### Features
123
+ Sort the keys:
124
+
125
+ ```console
126
+ $ i18n-tasks normalize
127
+ ```
128
+
129
+ Sort the keys, and move them to the respective files as defined by (`config.write`)[#multiple-locale-files]:
130
+
131
+ ```console
132
+ $ i18n-tasks normalize -p
133
+ ```
134
+
135
+ ### Features
128
136
 
129
137
  Relative keys (`t '.title'`) and plural keys (`key.{one,many,other,...}`) are fully supported.
130
138
  Scope argument is supported, but only when it is the first keyword argument ([improvements welcome](/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb)):
@@ -344,15 +352,6 @@ translation:
344
352
 
345
353
  `i18n-tasks irb` starts an IRB session in i18n-tasks context. Type `guide` for more information.
346
354
 
347
- ## RSpec integration
348
-
349
- You might want to test for missing and unused translations as part of your test suite.
350
- Install the spec file:
351
-
352
- ```console
353
- $ cp $(i18n-tasks gem-path)/templates/rspec/i18n_spec.rb spec/
354
- ```
355
-
356
355
  ### XLSX
357
356
 
358
357
  Export missing and unused data to XLSX:
@@ -368,23 +367,26 @@ While i18n-tasks does not provide an HTML version of the report, you can add [on
368
367
 
369
368
  ## Add New Tasks
370
369
 
371
- Tasks that come with the gem are defined in [lib/i18n/tasks/commands.rb](lib/i18n/tasks/commands.rb).
370
+ Tasks that come with the gem are defined in [lib/i18n/tasks/command/commands](lib/i18n/tasks/command/commands).
372
371
 
373
- You can add a new task by re-opening the class and loading it in i18n-tasks.yml:
372
+ Add a custom task like the ones defined by the gem:
374
373
 
375
374
  ```ruby
376
- # lib/i18n/tasks/my_task.rb
377
- I18n::Tasks::Commands.class_eval do
378
- desc 'my task'
379
- cmd :my_task do |opts = {}|
380
- puts i18n.data[opts[:arguments].try(:first) || base_locale]
375
+ # my_commands.rb
376
+ class MyCommands
377
+ include ::I18n::Tasks::Command::Collection
378
+ cmd :my_command, desc: 'my custom command'
379
+ def my_command(opts = {})
381
380
  end
382
381
  end
383
382
  ```
384
383
 
385
384
  ```yaml
386
385
  # config/i18n-tasks.yml
387
- <% require 'i18n/tasks/my_task' %>
386
+ <%
387
+ require 'my_commands'
388
+ I18n::Tasks::Commands.send :include, MyCommands
389
+ %>
388
390
  ```
389
391
 
390
392
  Run with:
@@ -396,8 +398,8 @@ $ i18n-tasks my-task
396
398
  [MIT license]: /LICENSE.txt
397
399
  [travis]: https://travis-ci.org/glebm/i18n-tasks
398
400
  [badge-travis]: http://img.shields.io/travis/glebm/i18n-tasks.svg
399
- [coveralls]: https://coveralls.io/r/glebm/i18n-tasks?branch=master
400
- [badge-coveralls]: http://img.shields.io/coveralls/glebm/i18n-tasks.svg
401
+ [coverage]: https://codeclimate.com/github/glebm/i18n-tasks
402
+ [badge-coverage]: https://img.shields.io/codeclimate/coverage/github/glebm/i18n-tasks.svg
401
403
  [gemnasium]: https://gemnasium.com/glebm/i18n-tasks
402
404
  [badge-gemnasium]: https://gemnasium.com/glebm/i18n-tasks.svg
403
405
  [code-climate]: https://codeclimate.com/github/glebm/i18n-tasks
data/bin/i18n-tasks CHANGED
@@ -1,6 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # coding: utf-8
3
3
 
4
+ # prevent i18n gem warning
5
+ require 'i18n'
6
+ i18n_gem_config = I18n.config
7
+ if i18n_gem_config.respond_to?(:enforce_available_locales=) && i18n_gem_config.enforce_available_locales.nil?
8
+ i18n_gem_config.enforce_available_locales = true
9
+ end
10
+
4
11
  require 'i18n/tasks'
5
12
  require 'i18n/tasks/commands'
6
13
  require 'slop'
@@ -14,47 +21,34 @@ err = proc { |message, exit_code|
14
21
  exit exit_code
15
22
  }
16
23
 
17
- command = nil
18
24
  begin
25
+ ran = false
26
+ commander = ::I18n::Tasks::Commands
27
+ slop_adapter = ::I18n::Tasks::SlopCommand
19
28
  args = ARGV.dup
20
29
  args = ['--help'] if args.empty?
21
- slop = Slop.parse(args, help: true) do
30
+ Slop.parse(args, help: true) do
22
31
  on('-v', '--version', 'Print the version') {
23
32
  puts I18n::Tasks::VERSION
24
33
  exit
25
34
  }
26
- ::I18n::Tasks::Commands.cmds.each do |name, attr|
27
- command name.tr('_', '-') do
28
- description attr.desc if attr.desc
29
- instance_exec(&attr.opts) if attr.opts
30
- run do |opts, args|
31
- command = [name, opts, args]
35
+ commander.cmds.each do |name, attr|
36
+ slop_dsl = slop_adapter.slop_command(name, attr) { |name, opts, args|
37
+ begin
38
+ ran = true
39
+ commander.run_command name, slop_adapter.parse_slop_opts_args(opts, args)
40
+ rescue Errno::EPIPE
41
+ # ignore Errno::EPIPE which is throw when pipe breaks, e.g.:
42
+ # i18n-tasks missing | head
43
+ exit 1
32
44
  end
33
- end
45
+ }
46
+ instance_exec &slop_dsl
34
47
  end
35
48
  end
36
49
  rescue Slop::Error => e
37
50
  err.call(e.message, 64)
38
51
  end
39
52
 
40
- if command
41
- cmd = ::I18n::Tasks::Commands.new
42
- meth = command[0]
43
- opts = command[1].to_hash.reject { |k, v| v.nil? }
44
- args = command[2]
45
- begin
46
- if opts.empty? && args.empty?
47
- cmd.log_verbose "run #{meth.tr('_', '-')} without arguments"
48
- cmd.send meth
49
- else
50
- opts = opts.merge(arguments: args) unless args.empty?
51
- cmd.log_verbose "run #{meth.tr('_', '-')} with #{opts.map { |k, v| "#{k}=#{v}" } * ' '}"
52
- cmd.send meth, opts
53
- end
54
- rescue Errno::EPIPE
55
- # ignore Errno::EPIPE which is throw when pipe breaks, e.g.:
56
- # i18n-tasks missing | head
57
- end
58
- else
59
- err.call("Command unknown: #{ARGV[0]}", 64) if ARGV[0]
60
- end
53
+
54
+ err.call("Command unknown: #{args[0]}", 64) if !ran && args[0]
@@ -0,0 +1,87 @@
1
+ # i18n-tasks works on itself! this is the internal config
2
+
3
+ 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]
7
+
8
+ # Read and write locale data
9
+ data:
10
+ ## by default, translation data are read from the file system, or you can provide a custom data adapter
11
+ # adapter: I18n::Tasks::Data::FileSystem
12
+
13
+ # Locale files to read from
14
+ read:
15
+ - config/locales/%{locale}.yml
16
+ # - config/locales/*.%{locale}.yml
17
+ # - config/locales/**/*.%{locale}.yml
18
+
19
+ # key => file routes, matched top to bottom
20
+ write:
21
+ ## E.g., write devise and simple form keys to their respective files
22
+ # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale.yml}']
23
+ # Catch-all
24
+ - config/locales/%{locale}.yml
25
+ # `i18n-tasks normalize -p` will force move the keys according to these rules
26
+
27
+ # YAML / JSON serializer options, passed to load / dump / parse / serialize
28
+ yaml:
29
+ write:
30
+ ## do not wrap lines at 80 characters (override default)
31
+ line_width: 96
32
+ json:
33
+ write:
34
+ # pretty print JSON
35
+ indent: ' '
36
+ space: ' '
37
+ object_nl: "\n"
38
+ array_nl: "\n"
39
+
40
+ # Find translate calls
41
+ search:
42
+ ## Default scanner finds t() and I18n.t() calls
43
+ # scanner: I18n::Tasks::Scanners::PatternWithScopeScanner
44
+
45
+ ## Paths to search in, passed to File.find
46
+ paths:
47
+ - lib/
48
+
49
+ ## Root for resolving relative keys (default)
50
+ # relative_roots:
51
+ # - app/views
52
+
53
+ ## File.fnmatch patterns to exclude from search (default)
54
+ # exclude: ["*.jpg", "*.png", "*.gif", "*.svg", "*.ico", "*.eot", "*.ttf", "*.woff", "*.pdf"]
55
+
56
+ ## Or, File.fnmatch patterns to include
57
+ # include: ["*.rb", "*.html.slim"]
58
+
59
+ ## Lines starting with # or / are ignored by default
60
+ # ignore_lines:
61
+ # - "^\\s*[#/](?!\\si18n-tasks-use)"
62
+
63
+ ## Google Translate
64
+ # translation:
65
+ # # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
66
+ # api_key: "AbC-dEf5"
67
+
68
+ ## Consider these keys not missing
69
+ # ignore_missing:
70
+ # - pagination.views.*
71
+
72
+ ## Consider these keys used
73
+ # ignore_unused:
74
+ # - 'simple_form.{yes,no}'
75
+ # - 'simple_form.{placeholders,hints,labels}.*'
76
+ # - 'simple_form.{error_notification,required}.:'
77
+
78
+ ## Exclude these keys from `i18n-tasks eq-base' report
79
+ # ignore_eq_base:
80
+ # all:
81
+ # - common.ok
82
+ # fr,es:
83
+ # - common.brand
84
+
85
+ ## Exclude these keys from all of the reports
86
+ # ignore:
87
+ # - kaminari.*
@@ -0,0 +1,95 @@
1
+ ---
2
+ en:
3
+ i18n_tasks:
4
+ common:
5
+ locale: Locale
6
+ type: Type
7
+ key: Key
8
+ value: Value
9
+ base_value: Base Value
10
+ details: Details
11
+ continue_q: Continue?
12
+ n_more: "%{count} more"
13
+ google_translate:
14
+ errors:
15
+ no_results: Google Translate returned no results. Make sure billing information is set at
16
+ https://code.google.com/apis/console.
17
+ remove_unused:
18
+ confirm:
19
+ one: One translations will be removed from %{locales}.
20
+ other: "%{count} translation will be removed from %{locales}."
21
+ removed: Removed %{count} keys
22
+ noop: No unused keys to remove
23
+ translate_missing:
24
+ translated: Translated %{count} keys
25
+ add_missing:
26
+ added: Added %{count} keys
27
+ unused:
28
+ none: Every translation is in use.
29
+ missing:
30
+ none: No translations are missing.
31
+ usages:
32
+ none: No key usages found.
33
+ health:
34
+ no_keys_detected: No keys detected. Check data.read in config/i18n-tasks.yml.
35
+ data_stats:
36
+ title: Forest (%{locales})
37
+ text: has %{key_count} keys across %{locale_count} locales. On average, values are %{value_chars_avg}
38
+ characters long, keys have %{key_segments_avg} segments, a locale has %{per_locale_avg} keys.
39
+ text_single_locale: has %{key_count} keys in total. On average, values are %{value_chars_avg}
40
+ characters long, keys have %{key_segments_avg} segments.
41
+ cmd:
42
+ encourage:
43
+ - Good job!
44
+ - Well done!
45
+ - Perfect!
46
+ desc:
47
+ normalize: 'normalize translation data: sort and move to the right files'
48
+ data: show locale data
49
+ data_merge: merge locale data with trees
50
+ data_write: replace locale data with tree
51
+ data_remove: remove keys present in tree from data
52
+ health: is everything OK?
53
+ find: show where keys are used in the code
54
+ unused: show unused translations
55
+ missing: show missing translations
56
+ translate_missing: translate missing keys with Google Translate
57
+ add_missing: add missing keys to locale data
58
+ remove_unused: remove unused keys
59
+ eq_base: show translations equal to base value
60
+ tree_merge: merge trees
61
+ tree_filter: filter tree by key pattern
62
+ tree_rename_key: rename tree node
63
+ tree_subtract: tree A minus the keys in tree B
64
+ tree_set_value: set values of keys, optionally match a pattern
65
+ tree_convert: convert tree between formats
66
+ config: display i18n-tasks configuration
67
+ gem_path: show path to the gem
68
+ irb: start REPL session within i18n-tasks context
69
+ args:
70
+ default_text: 'Default: %{value}'
71
+ desc:
72
+ out_format: 'Output format: %{valid_text}. %{default_text}.'
73
+ data_format: 'Data format: %{valid_text}. %{default_text}.'
74
+ keys: List of keys separated by commas (,), spaces, or newlines.
75
+ locales_filter: 'Comma-separated list of locale(s) to process. Default: all. Special: base.'
76
+ locale: 'Locale. Default: base'
77
+ confirm: Confirm automatically
78
+ nostdin: Do not read from stdin
79
+ strict: Do not infer dynamic key usage such as `t("category.\#{category.name}")`
80
+ missing_types: 'Filter by types: %{valid}.'
81
+ key_pattern: Filter by key pattern (e.g. 'common.*')
82
+ value: 'Value. Interpolates: %{value}, %{human_key}, %{value_or_human_key}'
83
+ pattern_router: 'Use pattern router: keys moved per config data.write'
84
+ enum_opt:
85
+ desc:
86
+ default: "%{valid_text}. %{default_text}"
87
+ invalid_one: "%{invalid} is not one of: %{valid}."
88
+ invalid_list: "%{invalid} is not in: %{valid}."
89
+ errors:
90
+ pass_forest: Pass locale forest
91
+ invalid_locale: Invalid locale %{invalid}
92
+ invalid_format: 'Unknown format %{invalid}. Valid: %{valid}.'
93
+ invalid_missing_type:
94
+ one: 'Unknown type %{invalid}. Valid: %{valid}.'
95
+ other: 'Unknown types: %{invalid}. Valid: %{valid}.'