i18n-tasks 0.3.0.rc1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +1 -1
- data/README.md +47 -39
- data/doc/img/i18n-tasks.png +0 -0
- data/i18n-tasks.gemspec +0 -1
- data/lib/i18n/tasks/commands.rb +8 -8
- data/lib/i18n/tasks/commands_base.rb +0 -2
- data/lib/i18n/tasks/missing_keys.rb +2 -2
- data/lib/i18n/tasks/reports/terminal.rb +1 -0
- data/lib/i18n/tasks/version.rb +1 -1
- data/spec/fixtures/config/i18n-tasks.yml +3 -0
- data/spec/i18n_tasks_spec.rb +25 -18
- data/spec/spec_helper.rb +0 -3
- metadata +4 -21
- data/lib/i18n/tasks/railtie.rb +0 -12
- data/lib/tasks/i18n-tasks.rake +0 -79
- data/spec/support/test_codebase_env.rake +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa70f1185066cd61c8e5caf67517f50a157e8edd
|
4
|
+
data.tar.gz: bf73f9deb48f10a6c7731fe74cb7f4fcd0da1e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452232becc66b4aabbb8e17af2fabe95b2ceb0004e7a461fb73a58bb2b24d323d2222c8b45d44da7d8090ab14ac62bce8cb76de88e46ee811860cab0c3668f89
|
7
|
+
data.tar.gz: b4c51a6b8a07fb81ceea48dcbd6ddbf0396d3f7027fd6e5ef5a53ed17cf81ed2b74dbb333bb760594db933a8604c0c9c2e6b49abe55584cad026537998e92e4f
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -3,23 +3,23 @@
|
|
3
3
|
|
4
4
|
Tasks to manage translations in ruby applications using I18n.
|
5
5
|
|
6
|
-
![i18n-screenshot](https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-tasks.
|
6
|
+
![i18n-screenshot](https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-tasks.png "i18n-tasks output screenshot")
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
10
|
1. Add to Gemfile:
|
11
11
|
|
12
|
-
```ruby
|
13
|
-
gem 'i18n-tasks', '~> 0.3.0'
|
14
|
-
```
|
12
|
+
```ruby
|
13
|
+
gem 'i18n-tasks', '~> 0.3.0'
|
14
|
+
```
|
15
15
|
|
16
16
|
2. Create a config file at `config/i18n-tasks.yml`:
|
17
17
|
|
18
|
-
```yaml
|
19
|
-
# config/i18n-tasks.yml
|
20
|
-
base_locale: en
|
21
|
-
locales: [es, fr]
|
22
|
-
```
|
18
|
+
```yaml
|
19
|
+
# config/i18n-tasks.yml
|
20
|
+
base_locale: en
|
21
|
+
locales: [es, fr]
|
22
|
+
```
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
@@ -46,39 +46,49 @@ Available commands:
|
|
46
46
|
See `<command> --help` for more information on a specific command.
|
47
47
|
```
|
48
48
|
|
49
|
-
There are reports for missing and unused translations
|
50
|
-
|
49
|
+
There are reports for `missing` and `unused` translations:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
i18n-tasks missing
|
53
|
+
i18n-tasks unused
|
54
|
+
```
|
51
55
|
|
56
|
+
Add missing values, generated from the key (for base locale) or copied from the base locale (for other locales).
|
52
57
|
|
53
|
-
|
54
|
-
Add placeholders for missing keys to the base locale only:
|
58
|
+
To add missing values to the base locale only:
|
55
59
|
|
56
60
|
```bash
|
57
|
-
|
61
|
+
# locales argument always accepts `base` and `all` as special values
|
62
|
+
i18n-tasks add-missing -l base
|
58
63
|
```
|
59
64
|
|
60
|
-
|
65
|
+
Translate missing values with Google Translate ([more below on the API key](#translation-config)).
|
61
66
|
|
62
67
|
```bash
|
63
68
|
i18n-tasks translate-missing
|
64
|
-
#
|
65
|
-
i18n-tasks translate-missing -l es,
|
69
|
+
# accepts from and locales options:
|
70
|
+
i18n-tasks translate-missing -f base -l es,fr
|
66
71
|
```
|
67
72
|
|
68
|
-
Sort the keys and write them to their respective files
|
73
|
+
Sort the keys and write them to their respective files with `normalize`.
|
74
|
+
This always happens on `add-missing` and `translate-missing`.
|
69
75
|
|
70
76
|
```bash
|
71
|
-
# always happens on add-missing or translate-missing
|
72
77
|
i18n-tasks normalize
|
73
78
|
```
|
74
79
|
|
75
|
-
|
80
|
+
See exactly where the keys are used with `find`:
|
76
81
|
|
77
|
-
```
|
78
|
-
|
79
|
-
|
82
|
+
```bash
|
83
|
+
# Show all usages of all keys
|
84
|
+
i18n-tasks find
|
85
|
+
# Filter by a key pattern
|
86
|
+
i18n-tasks find 'auth.*'
|
87
|
+
i18n-tasks find '{number,currency}.format.*'
|
80
88
|
```
|
81
89
|
|
90
|
+
![i18n-screenshot](https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-usages.png "i18n-tasks find output screenshot")
|
91
|
+
|
82
92
|
Relative keys (`t '.title'`) and plural keys (key.one/many/other/etc) are fully supported.
|
83
93
|
|
84
94
|
Scope argument is supported, but only when it is the first keyword argument ([this](/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb) can be improved):
|
@@ -90,16 +100,23 @@ t :invalid, scope: [:auth, :password], attempts: 5
|
|
90
100
|
t :invalid, attempts: 5, scope: [:auth, :password]
|
91
101
|
```
|
92
102
|
|
103
|
+
Unused report will detect pattern translations and not report them, e.g.:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
t 'category.' + category.key # all 'category.*' keys are considered used
|
107
|
+
t "category.#{category.key}.name" # all 'category.*.name' keys are considered used
|
108
|
+
```
|
109
|
+
|
93
110
|
Translation data storage, key usage search, and other [settings](#configuration) are compatible with Rails by default.
|
94
111
|
|
95
112
|
## Configuration
|
96
113
|
|
97
114
|
Configuration is read from `config/i18n-tasks.yml` or `config/i18n-tasks.yml.erb`.
|
98
|
-
|
115
|
+
Inspect configuration with `i18n-tasks config`.
|
99
116
|
|
100
117
|
### Locales
|
101
118
|
|
102
|
-
By default,
|
119
|
+
By default, i18n-tasks will read `I18n.default_locale` and `I18n.available_locales`.
|
103
120
|
However, i18n-tasks does not load application environment by default,
|
104
121
|
so it is recommended to set locale settings explicitly:
|
105
122
|
|
@@ -111,10 +128,12 @@ locales: [es, fr]
|
|
111
128
|
|
112
129
|
### Storage
|
113
130
|
|
131
|
+
The default data adapter supports YAML and JSON files.
|
132
|
+
|
114
133
|
```yaml
|
115
134
|
# i18n data storage
|
116
135
|
data:
|
117
|
-
#
|
136
|
+
# file_system is the default adapter, you can provide a custom class name here:
|
118
137
|
adapter: file_system
|
119
138
|
# a list of file globs to read from per-locale
|
120
139
|
read:
|
@@ -130,7 +149,7 @@ data:
|
|
130
149
|
- 'config/locales/%{locale}.yml' # path is short for ['*', path]
|
131
150
|
```
|
132
151
|
|
133
|
-
Key
|
152
|
+
#### Key pattern syntax
|
134
153
|
|
135
154
|
| syntax | description |
|
136
155
|
|:------------:|:----------------------------------------------------------|
|
@@ -151,17 +170,6 @@ data:
|
|
151
170
|
|
152
171
|
### Usage search
|
153
172
|
|
154
|
-
Inspect all the usages with:
|
155
|
-
|
156
|
-
```bash
|
157
|
-
i18n-tasks find
|
158
|
-
# Filter by a key pattern
|
159
|
-
i18n-tasks find 'auth.*
|
160
|
-
i18n-tasks find '{number,currency}.format.*'
|
161
|
-
```
|
162
|
-
|
163
|
-
![i18n-screenshot](https://raw.github.com/glebm/i18n-tasks/master/doc/img/i18n-usages.png "i18n-tasks find output screenshot")
|
164
|
-
|
165
173
|
|
166
174
|
Configure usage search in `config/i18n-tasks.yml`:
|
167
175
|
|
@@ -196,7 +204,7 @@ relative_roots:
|
|
196
204
|
```
|
197
205
|
|
198
206
|
It is also possible to use a custom key usage scanner by setting `search.scanner` to a class name.
|
199
|
-
See
|
207
|
+
See this basic [pattern scanner](/lib/i18n/tasks/scanners/pattern_scanner.rb) for reference.
|
200
208
|
|
201
209
|
|
202
210
|
### Fine-tuning
|
Binary file
|
data/i18n-tasks.gemspec
CHANGED
data/lib/i18n/tasks/commands.rb
CHANGED
@@ -9,8 +9,8 @@ module I18n::Tasks
|
|
9
9
|
|
10
10
|
desc 'show missing translations'
|
11
11
|
opts do
|
12
|
-
on '-l', :locales=, 'Filter by locale', as: Array, delimiter: /[+:,]/, default: 'all'
|
13
|
-
on '-t', :types, 'Filter by type (types: missing_from_base, eq_base, missing_from_locale)', as: Array, delimiter: /[+:,]
|
12
|
+
on '-l', :locales=, 'Filter by locale', as: Array, delimiter: /[+:,]/, default: 'all', argument: true, optional: false
|
13
|
+
on '-t', :types, 'Filter by type (types: missing_from_base, eq_base, missing_from_locale)', as: Array, delimiter: /[+:,]/, argument: true, optional: false
|
14
14
|
end
|
15
15
|
cmd :missing do |opt = {}|
|
16
16
|
opt[:locales] = locales_opt(opt[:locales])
|
@@ -24,8 +24,8 @@ module I18n::Tasks
|
|
24
24
|
|
25
25
|
desc 'translate missing keys with Google Translate'
|
26
26
|
opts do
|
27
|
-
on '-l', :locales, 'Only specified locales', as: Array, delimiter: /[+:,]
|
28
|
-
on '-f', :from, 'Locale to translate from (default: base)', default: 'base'
|
27
|
+
on '-l', :locales, 'Only specified locales', as: Array, delimiter: /[+:,]/, default: 'all', argument: true, optional: false
|
28
|
+
on '-f', :from, 'Locale to translate from (default: base)', default: 'base', argument: true, optional: false
|
29
29
|
end
|
30
30
|
cmd :translate_missing do |opt = {}|
|
31
31
|
opt[:from] = base_locale if opt[:from].blank? || opt[:from] == 'base'
|
@@ -35,8 +35,8 @@ module I18n::Tasks
|
|
35
35
|
|
36
36
|
desc 'add missing keys to the locales'
|
37
37
|
opts do
|
38
|
-
on '-p', :placeholder, 'Value for empty keys (default: base value or key.humanize)'
|
39
|
-
on '-l', :locales, 'Only for specified locales', as: Array, delimiter: /[+:,]
|
38
|
+
on '-p', :placeholder, 'Value for empty keys (default: base value or key.humanize)', argument: true, optional: false
|
39
|
+
on '-l', :locales, 'Only for specified locales', as: Array, delimiter: /[+:,]/, default: 'all', argument: true, optional: false
|
40
40
|
end
|
41
41
|
cmd :add_missing do |opt = {}|
|
42
42
|
opt[:locales] = locales_opt(opt[:locale] || opt[:locales])
|
@@ -63,7 +63,7 @@ module I18n::Tasks
|
|
63
63
|
|
64
64
|
desc 'normalize translation data: sort and move to the right files'
|
65
65
|
opts do
|
66
|
-
on '-l', :locales=, 'Only for specified locales', as: Array, delimiter: /[+:,]
|
66
|
+
on '-l', :locales=, 'Only for specified locales', as: Array, delimiter: /[+:,]/, default: 'all', argument: true, optional: false
|
67
67
|
end
|
68
68
|
cmd :normalize do |opt = {}|
|
69
69
|
i18n_task.normalize_store! locales_opt(opt[:locales])
|
@@ -71,7 +71,7 @@ module I18n::Tasks
|
|
71
71
|
|
72
72
|
desc 'remove unused keys'
|
73
73
|
opts do
|
74
|
-
on '-l', :locales=, 'Only for specified locales', as: Array, delimiter: /[+:,]
|
74
|
+
on '-l', :locales=, 'Only for specified locales', as: Array, delimiter: /[+:,]/, default: 'all', argument: true, optional: false
|
75
75
|
end
|
76
76
|
cmd :remove_unused do |opt = {}|
|
77
77
|
locales = locales_opt opt[:locales]
|
@@ -6,11 +6,11 @@ module I18n::Tasks
|
|
6
6
|
locales = non_base_locales(opts[:locales])
|
7
7
|
type = opts[:type]
|
8
8
|
unless type
|
9
|
-
types = opts[:types] || missing_keys_types
|
9
|
+
types = opts[:types].presence || missing_keys_types
|
10
10
|
opts = opts.except(:types).merge(locales: locales)
|
11
11
|
return types.map { |t| missing_keys(opts.merge(type: t)) }.reduce(:+)
|
12
12
|
end
|
13
|
-
if type ==
|
13
|
+
if type.to_s == 'missing_from_base'
|
14
14
|
keys_missing_from_base
|
15
15
|
else
|
16
16
|
locales.map { |locale| send("keys_#{type}", locale) }.reduce(:+) || KeyGroup.new([])
|
@@ -57,6 +57,7 @@ module I18n
|
|
57
57
|
|
58
58
|
def unused_keys(keys = task.unused_keys)
|
59
59
|
print_title unused_title(keys)
|
60
|
+
keys.sort_by_attr!(key: :asc)
|
60
61
|
if keys.present?
|
61
62
|
print_table headings: [bold(magenta('i18n Key')), bold(cyan("Base value (#{base_locale})"))] do |t|
|
62
63
|
t.rows = keys.map { |k| [magenta(k.key), cyan(k.value)] }
|
data/lib/i18n/tasks/version.rb
CHANGED
data/spec/i18n_tasks_spec.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require 'spec_helper'
|
3
|
+
require 'i18n/tasks/commands'
|
3
4
|
require 'fileutils'
|
4
5
|
|
5
|
-
describe '
|
6
|
+
describe 'i18n-tasks' do
|
7
|
+
def run_cmd(name, *args, &block)
|
8
|
+
TestCodebase.in_test_app_dir do
|
9
|
+
capture_stdout { ::I18n::Tasks::Commands.new.send(name, *args, &block) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
6
13
|
describe 'missing' do
|
7
14
|
it 'detects missing or identical' do
|
8
15
|
capture_stderr do
|
9
|
-
expect(
|
16
|
+
expect(run_cmd :missing).to be_i18n_keys %w(
|
10
17
|
en.used_but_missing.a en.relative.index.missing
|
11
18
|
es.missing_in_es.a es.blank_in_es.a es.same_in_es.a
|
12
19
|
en.hash.pattern_missing.a en.hash.pattern_missing.b
|
@@ -16,16 +23,16 @@ describe 'rake i18n' do
|
|
16
23
|
end
|
17
24
|
end
|
18
25
|
|
26
|
+
let(:expected_unused_keys) { %w(unused.a unused.numeric unused.plural) }
|
19
27
|
describe 'unused' do
|
20
|
-
let(:expected_unused_keys) { %w(unused.a unused.numeric unused.plural) }
|
21
|
-
|
22
28
|
it 'detects unused' do
|
23
29
|
capture_stderr do
|
24
|
-
|
25
|
-
expect(out).to be_i18n_keys expected_unused_keys
|
30
|
+
expect(run_cmd :unused).to be_i18n_keys expected_unused_keys
|
26
31
|
end
|
27
32
|
end
|
33
|
+
end
|
28
34
|
|
35
|
+
describe 'remove_unused' do
|
29
36
|
it 'removes unused' do
|
30
37
|
TestCodebase.in_test_app_dir do
|
31
38
|
t = I18n::Tasks::BaseTask.new
|
@@ -35,7 +42,7 @@ describe 'rake i18n' do
|
|
35
42
|
end
|
36
43
|
ENV['CONFIRM'] = '1'
|
37
44
|
capture_stderr {
|
38
|
-
|
45
|
+
run_cmd :remove_unused
|
39
46
|
}
|
40
47
|
t.data.reload
|
41
48
|
expected_unused_keys.each do |key|
|
@@ -50,16 +57,16 @@ describe 'rake i18n' do
|
|
50
57
|
it 'moves keys to the corresponding files as per data.write' do
|
51
58
|
TestCodebase.in_test_app_dir {
|
52
59
|
expect(File).to_not exist 'config/locales/devise.en.yml'
|
53
|
-
|
60
|
+
run_cmd :normalize
|
54
61
|
expect(YAML.load_file('config/locales/devise.en.yml')['en']['devise']['a']).to eq 'EN_TEXT'
|
55
62
|
}
|
56
63
|
end
|
57
64
|
end
|
58
65
|
|
59
|
-
describe '
|
66
|
+
describe 'xlsx_report' do
|
60
67
|
it 'saves' do
|
61
68
|
TestCodebase.in_test_app_dir {
|
62
|
-
capture_stderr {
|
69
|
+
capture_stderr { run_cmd :xlsx_report }
|
63
70
|
expect(File).to exist 'tmp/i18n-report.xlsx'
|
64
71
|
FileUtils.cp('tmp/i18n-report.xlsx', '..')
|
65
72
|
}
|
@@ -68,21 +75,21 @@ describe 'rake i18n' do
|
|
68
75
|
end
|
69
76
|
|
70
77
|
describe 'add_missing' do
|
71
|
-
it 'placeholder' do
|
78
|
+
it 'default placeholder' do
|
72
79
|
TestCodebase.in_test_app_dir {
|
73
80
|
expect(YAML.load_file('config/locales/en.yml')['en']['used_but_missing']).to be_nil
|
74
81
|
}
|
75
|
-
|
82
|
+
run_cmd :add_missing, locales: 'base'
|
76
83
|
TestCodebase.in_test_app_dir {
|
77
84
|
expect(YAML.load_file('config/locales/en.yml')['en']['used_but_missing']['a']).to eq 'A'
|
78
85
|
}
|
79
86
|
end
|
80
87
|
|
81
|
-
it 'placeholder
|
88
|
+
it 'placeholder: value' do
|
82
89
|
TestCodebase.in_test_app_dir {
|
83
90
|
expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']).to be_nil
|
84
91
|
}
|
85
|
-
|
92
|
+
run_cmd :add_missing, locales: 'all', placeholder: 'TRME'
|
86
93
|
TestCodebase.in_test_app_dir {
|
87
94
|
expect(YAML.load_file('config/locales/es.yml')['es']['missing_in_es']['a']).to eq 'TRME'
|
88
95
|
# does not touch existing, but moves to the right file:
|
@@ -91,18 +98,18 @@ describe 'rake i18n' do
|
|
91
98
|
end
|
92
99
|
end
|
93
100
|
|
94
|
-
describe '
|
101
|
+
describe 'config' do
|
95
102
|
it 'prints config' do
|
96
|
-
expect(YAML.load(
|
103
|
+
expect(YAML.load(run_cmd :config)).to(
|
97
104
|
eq TestCodebase.in_test_app_dir { I18n::Tasks::BaseTask.new.config_for_inspect }
|
98
105
|
)
|
99
106
|
end
|
100
107
|
end
|
101
108
|
|
102
|
-
describe '
|
109
|
+
describe 'find' do
|
103
110
|
it 'prints usages' do
|
104
111
|
capture_stderr do
|
105
|
-
expect(
|
112
|
+
expect(run_cmd :find, arguments: ['used.*']).to eq(<<-TXT)
|
106
113
|
used.a 2
|
107
114
|
app/views/usages.html.slim:1 p = t 'used.a'
|
108
115
|
app/views/usages.html.slim:2 b = t 'used.a'
|
data/spec/spec_helper.rb
CHANGED
@@ -11,9 +11,6 @@ $: << File.expand_path('../lib', __FILE__)
|
|
11
11
|
require 'i18n/tasks'
|
12
12
|
require 'rake'
|
13
13
|
|
14
|
-
Rake.load_rakefile 'tasks/i18n-tasks.rake'
|
15
|
-
Rake.load_rakefile 'support/test_codebase_env.rake'
|
16
|
-
|
17
14
|
require 'term/ansicolor'
|
18
15
|
Term::ANSIColor::coloring = false
|
19
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebm
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: erubis
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,6 +198,7 @@ files:
|
|
212
198
|
- README.md
|
213
199
|
- Rakefile
|
214
200
|
- bin/i18n-tasks
|
201
|
+
- doc/img/i18n-tasks.png
|
215
202
|
- i18n-tasks.gemspec
|
216
203
|
- lib/i18n/tasks.rb
|
217
204
|
- lib/i18n/tasks/base_task.rb
|
@@ -235,7 +222,6 @@ files:
|
|
235
222
|
- lib/i18n/tasks/key_pattern_matching.rb
|
236
223
|
- lib/i18n/tasks/missing_keys.rb
|
237
224
|
- lib/i18n/tasks/plural_keys.rb
|
238
|
-
- lib/i18n/tasks/railtie.rb
|
239
225
|
- lib/i18n/tasks/relative_keys.rb
|
240
226
|
- lib/i18n/tasks/reports/base.rb
|
241
227
|
- lib/i18n/tasks/reports/spreadsheet.rb
|
@@ -247,7 +233,6 @@ files:
|
|
247
233
|
- lib/i18n/tasks/unused_keys.rb
|
248
234
|
- lib/i18n/tasks/used_keys.rb
|
249
235
|
- lib/i18n/tasks/version.rb
|
250
|
-
- lib/tasks/i18n-tasks.rake
|
251
236
|
- spec/file_system_data_spec.rb
|
252
237
|
- spec/fixtures/app/assets/javascripts/application.js
|
253
238
|
- spec/fixtures/app/controllers/events_controller.rb
|
@@ -268,7 +253,6 @@ files:
|
|
268
253
|
- spec/support/i18n_tasks_output_matcher.rb
|
269
254
|
- spec/support/key_pattern_matcher.rb
|
270
255
|
- spec/support/test_codebase.rb
|
271
|
-
- spec/support/test_codebase_env.rake
|
272
256
|
- spec/used_keys_spec.rb
|
273
257
|
homepage: https://github.com/glebm/i18n-tasks
|
274
258
|
licenses:
|
@@ -286,9 +270,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
286
270
|
version: '0'
|
287
271
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
272
|
requirements:
|
289
|
-
- - '
|
273
|
+
- - '>='
|
290
274
|
- !ruby/object:Gem::Version
|
291
|
-
version:
|
275
|
+
version: '0'
|
292
276
|
requirements: []
|
293
277
|
rubyforge_project:
|
294
278
|
rubygems_version: 2.0.14
|
@@ -317,6 +301,5 @@ test_files:
|
|
317
301
|
- spec/support/i18n_tasks_output_matcher.rb
|
318
302
|
- spec/support/key_pattern_matcher.rb
|
319
303
|
- spec/support/test_codebase.rb
|
320
|
-
- spec/support/test_codebase_env.rake
|
321
304
|
- spec/used_keys_spec.rb
|
322
305
|
has_rdoc:
|
data/lib/i18n/tasks/railtie.rb
DELETED
data/lib/tasks/i18n-tasks.rake
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'i18n/tasks'
|
2
|
-
require 'i18n/tasks/commands'
|
3
|
-
|
4
|
-
cmd = I18n::Tasks::Commands.new
|
5
|
-
|
6
|
-
namespace :i18n do
|
7
|
-
task :setup do
|
8
|
-
end
|
9
|
-
|
10
|
-
desc cmd.desc :missing
|
11
|
-
task :missing, [:locales] => 'i18n:setup' do |t, args|
|
12
|
-
cmd.missing locales: args[:locales]
|
13
|
-
end
|
14
|
-
|
15
|
-
namespace :missing do
|
16
|
-
desc 'keys present in code but not existing in base locale data'
|
17
|
-
task :missing_from_base => 'i18n:setup' do
|
18
|
-
cmd.missing type: :missing_from_base
|
19
|
-
end
|
20
|
-
|
21
|
-
desc 'keys present but with value same as in base locale'
|
22
|
-
task :eq_base, [:locales] => 'i18n:setup' do |t, args|
|
23
|
-
cmd.missing type: :eq_base, locales: args[:locales]
|
24
|
-
end
|
25
|
-
|
26
|
-
desc 'keys that exist in base locale but are blank in passed locales'
|
27
|
-
task :missing_from_locale, [:locales] => 'i18n:setup' do |t, args|
|
28
|
-
cmd.missing type: :missing_from_locale, locales: args[:locales]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
desc cmd.desc :show_unused
|
33
|
-
task :unused => 'i18n:setup' do
|
34
|
-
cmd.unused
|
35
|
-
end
|
36
|
-
|
37
|
-
desc cmd.desc :remove_unused
|
38
|
-
task :remove_unused, [:locales] => 'i18n:setup' do |t, args|
|
39
|
-
cmd.remove_unused
|
40
|
-
end
|
41
|
-
|
42
|
-
desc cmd.desc :usages
|
43
|
-
task :usages, [:filter] => 'i18n:setup' do |t, args|
|
44
|
-
cmd.find filter: args[:filter]
|
45
|
-
end
|
46
|
-
|
47
|
-
desc cmd.desc :normalize
|
48
|
-
task :normalize, [:locales] => 'i18n:setup' do |t, args|
|
49
|
-
cmd.normalize locales: args[:locales]
|
50
|
-
end
|
51
|
-
|
52
|
-
namespace :add_missing do
|
53
|
-
desc 'add Google Translated values for untranslated keys to locales (default: all non-base)'
|
54
|
-
task :translate, [:locales] => 'i18n:setup' do |t, args|
|
55
|
-
cmd.translate locales: args[:locales]
|
56
|
-
end
|
57
|
-
|
58
|
-
desc 'copy base locale values for all untranslated keys to locales (default: all non-base)'
|
59
|
-
task :placeholder, [:locales, :placeholder] => 'i18n:setup' do |t, args|
|
60
|
-
cmd.add_missing locale: args[:locales], placeholder: args[:placeholder]
|
61
|
-
end
|
62
|
-
|
63
|
-
desc 'add values for missing and untranslated keys to locales (default: all)'
|
64
|
-
task :empty_string, [:locales] => 'i18n:setup' do |t, args|
|
65
|
-
cmd.add_missing locales: args[:locales], placeholder: ''
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
desc cmd.desc(:config)
|
70
|
-
task :tasks_config => 'i18n:setup' do
|
71
|
-
cmd.config
|
72
|
-
end
|
73
|
-
|
74
|
-
desc cmd.desc :save_spreadsheet
|
75
|
-
task :spreadsheet_report, [:path] => 'i18n:setup' do |t, args|
|
76
|
-
cmd.xlsx_report path: args[:path]
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|