i18n-tasks 0.8.7 → 0.9.0.rc1
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.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/CHANGES.md +3 -3
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/bin/i18n-tasks +0 -1
- data/config/locales/en.yml +103 -102
- data/config/locales/ru.yml +1 -1
- data/i18n-tasks.gemspec +1 -2
- data/lib/i18n/tasks.rb +0 -1
- data/lib/i18n/tasks/base_task.rb +0 -1
- data/lib/i18n/tasks/cli.rb +1 -1
- data/lib/i18n/tasks/command/commander.rb +0 -1
- data/lib/i18n/tasks/command/commands/missing.rb +3 -15
- data/lib/i18n/tasks/command/commands/usages.rb +5 -6
- data/lib/i18n/tasks/command/option_parsers/locale.rb +1 -8
- data/lib/i18n/tasks/command_error.rb +5 -1
- data/lib/i18n/tasks/commands.rb +0 -1
- data/lib/i18n/tasks/configuration.rb +1 -9
- data/lib/i18n/tasks/console_context.rb +2 -2
- data/lib/i18n/tasks/data.rb +0 -1
- data/lib/i18n/tasks/data/adapter/json_adapter.rb +0 -1
- data/lib/i18n/tasks/data/adapter/yaml_adapter.rb +0 -1
- data/lib/i18n/tasks/data/file_formats.rb +0 -1
- data/lib/i18n/tasks/data/file_system.rb +0 -1
- data/lib/i18n/tasks/data/file_system_base.rb +0 -1
- data/lib/i18n/tasks/data/router/conservative_router.rb +0 -1
- data/lib/i18n/tasks/data/router/pattern_router.rb +0 -1
- data/lib/i18n/tasks/data/tree/node.rb +6 -7
- data/lib/i18n/tasks/data/tree/nodes.rb +0 -1
- data/lib/i18n/tasks/data/tree/siblings.rb +29 -10
- data/lib/i18n/tasks/data/tree/traversal.rb +0 -3
- data/lib/i18n/tasks/google_translation.rb +0 -1
- data/lib/i18n/tasks/ignore_keys.rb +0 -1
- data/lib/i18n/tasks/key_pattern_matching.rb +0 -1
- data/lib/i18n/tasks/logging.rb +0 -1
- data/lib/i18n/tasks/missing_keys.rb +0 -1
- data/lib/i18n/tasks/plural_keys.rb +0 -1
- data/lib/i18n/tasks/reports/base.rb +1 -2
- data/lib/i18n/tasks/reports/spreadsheet.rb +0 -1
- data/lib/i18n/tasks/reports/terminal.rb +41 -17
- data/lib/i18n/tasks/scanners/files/caching_file_finder.rb +32 -0
- data/lib/i18n/tasks/scanners/files/caching_file_finder_provider.rb +24 -0
- data/lib/i18n/tasks/scanners/files/caching_file_reader.rb +27 -0
- data/lib/i18n/tasks/scanners/files/file_finder.rb +61 -0
- data/lib/i18n/tasks/scanners/files/file_reader.rb +18 -0
- data/lib/i18n/tasks/scanners/key_occurrences.rb +35 -0
- data/lib/i18n/tasks/scanners/occurence.rb +50 -0
- data/lib/i18n/tasks/scanners/pattern_scanner.rb +97 -38
- data/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb +2 -3
- data/lib/i18n/tasks/scanners/relative_keys.rb +3 -4
- data/lib/i18n/tasks/scanners/scanner.rb +15 -0
- data/lib/i18n/tasks/scanners/scanner_multiplexer.rb +43 -0
- data/lib/i18n/tasks/unused_keys.rb +4 -5
- data/lib/i18n/tasks/used_keys.rb +76 -23
- data/lib/i18n/tasks/version.rb +1 -2
- data/spec/conservative_router_spec.rb +0 -1
- data/spec/file_system_data_spec.rb +0 -1
- data/spec/fixtures/app/controllers/events_controller.rb +1 -2
- data/spec/google_translate_spec.rb +0 -1
- data/spec/i18n_tasks_spec.rb +4 -15
- data/spec/key_pattern_matching_spec.rb +0 -1
- data/spec/locale_tree/siblings_spec.rb +0 -1
- data/spec/pattern_scanner_spec.rb +34 -36
- data/spec/plural_keys_spec.rb +0 -1
- data/spec/readme_spec.rb +0 -1
- data/spec/relative_keys_spec.rb +15 -10
- data/spec/scanners/files/caching_file_finder_provider_spec.rb +18 -0
- data/spec/scanners/files/caching_file_finder_spec.rb +39 -0
- data/spec/scanners/files/caching_file_reader_spec.rb +18 -0
- data/spec/scanners/files/file_finder_spec.rb +52 -0
- data/spec/scanners/files/file_reader_spec.rb +15 -0
- data/spec/scanners/scanner_multiplexer_spec.rb +26 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/capture_std.rb +0 -1
- data/spec/support/fixtures.rb +0 -1
- data/spec/support/i18n_tasks_output_matcher.rb +0 -1
- data/spec/support/key_pattern_matcher.rb +0 -1
- data/spec/support/keys_and_occurrences.rb +27 -0
- data/spec/support/test_codebase.rb +0 -1
- data/spec/support/trees.rb +1 -7
- data/spec/used_keys_spec.rb +15 -16
- data/templates/config/i18n-tasks.yml +9 -2
- metadata +29 -9
- data/lib/i18n/tasks/scanners/base_scanner.rb +0 -149
- data/spec/commands/missing_commands_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 032b4f63664580dc57f296ae0379fc282bdadf26
|
4
|
+
data.tar.gz: 217065770a8d92a96b8cf9009ddb7d2dc7dfea30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f20aadc5aa981419c3b6e5641ba3f18c8012d533b54d1e7a7df4490e56b1fe8d60bb2bb8bd7422e61534ac05ec16f3983bd1f360699e1e9dcb4d262ba466b6af
|
7
|
+
data.tar.gz: 34f9ab86382cf2ac7c307d4106c2eb470dc270ad97b72a8d4d462d5f5116a7651aa849624623bcbb0a68d48dd25c4775fe113db560395df7196ca44bcc7a88f3
|
data/.travis.yml
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.2.
|
4
|
-
-
|
5
|
-
- jruby
|
3
|
+
- 2.2.2
|
4
|
+
- jruby-9000
|
6
5
|
- rbx
|
7
|
-
|
8
|
-
|
6
|
+
matrix:
|
7
|
+
allow_failures:
|
8
|
+
- rvm: rbx
|
9
9
|
cache: bundler
|
10
10
|
script: bundle exec rspec
|
11
|
+
sudo: false
|
11
12
|
env:
|
12
13
|
global:
|
13
14
|
- TRAVIS=1
|
data/CHANGES.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.9.0.rc1
|
2
2
|
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Support for multiple scanners.
|
4
|
+
* Strict mode enabled by default, can be configured via `search.strict`. New argument: `--no-strict`.
|
5
5
|
|
6
6
|
## 0.8.6
|
7
7
|
|
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ gemspec
|
|
5
5
|
|
6
6
|
unless ENV['TRAVIS']
|
7
7
|
group :development do
|
8
|
-
gem 'byebug', platforms: [:mri_21, :mri_22], require: false
|
8
|
+
gem 'byebug', platforms: [:mri_21, :mri_22, :mswin, :x64_mingw_21, :x64_mingw_22], require: false
|
9
9
|
gem 'rubinius-debugger', platform: :rbx, require: false
|
10
10
|
end
|
11
11
|
end
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
|
|
24
24
|
Add i18n-tasks to the Gemfile:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
gem 'i18n-tasks', '~> 0.
|
27
|
+
gem 'i18n-tasks', '~> 0.9.0.rc1'
|
28
28
|
```
|
29
29
|
|
30
30
|
Copy the default [configuration file](#configuration):
|
@@ -72,7 +72,7 @@ $ i18n-tasks add-missing --help
|
|
72
72
|
Usage: i18n-tasks add-missing [options] [locale ...]
|
73
73
|
-l, --locales Comma-separated list of locale(s) to process. Default: all. Special: base.
|
74
74
|
-f, --format Output format: terminal-table, yaml, json, keys, inspect. Default: terminal-table.
|
75
|
-
-v, --value Value. Interpolates: %{value}, %{human_key}, %{value_or_human_key}
|
75
|
+
-v, --value Value. Interpolates: %{value}, %{human_key}, %{value_or_human_key}. Default: %{value_or_human_key}.
|
76
76
|
-h, --help Display this help message.
|
77
77
|
```
|
78
78
|
|
@@ -105,8 +105,8 @@ $ i18n-tasks unused
|
|
105
105
|
$ i18n-tasks remove-unused
|
106
106
|
```
|
107
107
|
|
108
|
-
These tasks
|
109
|
-
|
108
|
+
These tasks can infer [dynamic keys](#dynamic-keys) such as `t("category.\#{category.name}")` if you set
|
109
|
+
`search.strict` to false, or pass `--no-strict` on the command line.
|
110
110
|
|
111
111
|
### Normalize data
|
112
112
|
|
data/bin/i18n-tasks
CHANGED
data/config/locales/en.yml
CHANGED
@@ -1,102 +1,103 @@
|
|
1
|
-
---
|
2
|
-
en:
|
3
|
-
i18n_tasks:
|
4
|
-
add_missing:
|
5
|
-
added:
|
6
|
-
one: Added %{count} key
|
7
|
-
other: Added %{count} keys
|
8
|
-
cmd:
|
9
|
-
args:
|
10
|
-
default_text: 'Default: %{value}'
|
11
|
-
desc:
|
12
|
-
confirm: Confirm automatically
|
13
|
-
data_format: 'Data format: %{valid_text}.'
|
14
|
-
key_pattern: Filter by key pattern (e.g. 'common.*')
|
15
|
-
key_pattern_to_rename: Full key (pattern) to rename. Required
|
16
|
-
locale: Locale
|
17
|
-
locale_to_translate_from: Locale to translate from
|
18
|
-
locales_filter: 'Locale(s) to process. Special: base'
|
19
|
-
missing_types: 'Filter by types: %{valid}'
|
20
|
-
new_key_name: New name, interpolates original name as %{key}. Required
|
21
|
-
nostdin: Do not read from stdin
|
22
|
-
out_format: 'Output format: %{valid_text}'
|
23
|
-
pattern_router: 'Use pattern router: keys moved per config data.write'
|
24
|
-
strict:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
i18n_tasks:
|
4
|
+
add_missing:
|
5
|
+
added:
|
6
|
+
one: Added %{count} key
|
7
|
+
other: Added %{count} keys
|
8
|
+
cmd:
|
9
|
+
args:
|
10
|
+
default_text: 'Default: %{value}'
|
11
|
+
desc:
|
12
|
+
confirm: Confirm automatically
|
13
|
+
data_format: 'Data format: %{valid_text}.'
|
14
|
+
key_pattern: Filter by key pattern (e.g. 'common.*')
|
15
|
+
key_pattern_to_rename: Full key (pattern) to rename. Required
|
16
|
+
locale: Locale
|
17
|
+
locale_to_translate_from: Locale to translate from
|
18
|
+
locales_filter: 'Locale(s) to process. Special: base'
|
19
|
+
missing_types: 'Filter by types: %{valid}'
|
20
|
+
new_key_name: New name, interpolates original name as %{key}. Required
|
21
|
+
nostdin: Do not read from stdin
|
22
|
+
out_format: 'Output format: %{valid_text}'
|
23
|
+
pattern_router: 'Use pattern router: keys moved per config data.write'
|
24
|
+
strict: Avoid inferring dynamic key usages such as t("cats.#{cat}.name"). Takes precedence over the
|
25
|
+
config setting if set.
|
26
|
+
value: 'Value. Interpolates: %{value}, %{human_key}, %{value_or_human_key}'
|
27
|
+
desc:
|
28
|
+
add_missing: add missing keys to locale data
|
29
|
+
config: display i18n-tasks configuration
|
30
|
+
data: show locale data
|
31
|
+
data_merge: merge locale data with trees
|
32
|
+
data_remove: remove keys present in tree from data
|
33
|
+
data_write: replace locale data with tree
|
34
|
+
eq_base: show translations equal to base value
|
35
|
+
find: show where keys are used in the code
|
36
|
+
gem_path: show path to the gem
|
37
|
+
health: is everything OK?
|
38
|
+
irb: start REPL session within i18n-tasks context
|
39
|
+
missing: show missing translations
|
40
|
+
normalize: 'normalize translation data: sort and move to the right files'
|
41
|
+
remove_unused: remove unused keys
|
42
|
+
translate_missing: translate missing keys with Google Translate
|
43
|
+
tree_convert: convert tree between formats
|
44
|
+
tree_filter: filter tree by key pattern
|
45
|
+
tree_merge: merge trees
|
46
|
+
tree_rename_key: rename tree node
|
47
|
+
tree_set_value: set values of keys, optionally match a pattern
|
48
|
+
tree_subtract: tree A minus the keys in tree B
|
49
|
+
tree_translate: Google Translate a tree to root locales
|
50
|
+
unused: show unused translations
|
51
|
+
xlsx_report: save missing and unused translations to an Excel file
|
52
|
+
encourage:
|
53
|
+
- Good job!
|
54
|
+
- Well done!
|
55
|
+
- Perfect!
|
56
|
+
enum_list_opt:
|
57
|
+
invalid: "%{invalid} is not in: %{valid}."
|
58
|
+
enum_opt:
|
59
|
+
invalid: "%{invalid} is not one of: %{valid}."
|
60
|
+
errors:
|
61
|
+
invalid_format: 'invalid format: %{invalid}. valid: %{valid}.'
|
62
|
+
invalid_locale: 'invalid locale: %{invalid}'
|
63
|
+
invalid_missing_type:
|
64
|
+
one: 'invalid type: %{invalid}. valid: %{valid}.'
|
65
|
+
other: 'unknown types: %{invalid}. valid: %{valid}.'
|
66
|
+
pass_forest: pass locale forest
|
67
|
+
common:
|
68
|
+
base_value: Base Value
|
69
|
+
continue_q: Continue?
|
70
|
+
key: Key
|
71
|
+
locale: Locale
|
72
|
+
n_more: "%{count} more"
|
73
|
+
type: Type
|
74
|
+
value: Value
|
75
|
+
data_stats:
|
76
|
+
text: has %{key_count} keys across %{locale_count} locales. On average, values are %{value_chars_avg}
|
77
|
+
characters long, keys have %{key_segments_avg} segments, a locale has %{per_locale_avg} keys.
|
78
|
+
text_single_locale: has %{key_count} keys in total. On average, values are %{value_chars_avg}
|
79
|
+
characters long, keys have %{key_segments_avg} segments.
|
80
|
+
title: Forest (%{locales})
|
81
|
+
google_translate:
|
82
|
+
errors:
|
83
|
+
no_api_key: Set Google API key via GOOGLE_TRANSLATE_API_KEY environment variable or translation.api_key
|
84
|
+
in config/i18n-tasks.yml. Get the key at https://code.google.com/apis/console.
|
85
|
+
no_results: Google Translate returned no results. Make sure billing information is set at
|
86
|
+
https://code.google.com/apis/console.
|
87
|
+
health:
|
88
|
+
no_keys_detected: No keys detected. Check data.read in config/i18n-tasks.yml.
|
89
|
+
missing:
|
90
|
+
details_title: Value in other locales or source
|
91
|
+
none: No translations are missing.
|
92
|
+
remove_unused:
|
93
|
+
confirm:
|
94
|
+
one: "%{count} translation will be removed from %{locales}."
|
95
|
+
other: "%{count} translation will be removed from %{locales}."
|
96
|
+
noop: No unused keys to remove
|
97
|
+
removed: Removed %{count} keys
|
98
|
+
translate_missing:
|
99
|
+
translated: Translated %{count} keys
|
100
|
+
unused:
|
101
|
+
none: Every translation is in use.
|
102
|
+
usages:
|
103
|
+
none: No key usages found.
|
data/config/locales/ru.yml
CHANGED
@@ -21,7 +21,7 @@ ru:
|
|
21
21
|
out_format: "Формат вывода: %{valid_text}. %{default_text}."
|
22
22
|
pattern_router: "Использовать pattern_router: ключи распределятся по файлам согласно data.write"
|
23
23
|
strict: Не угадывать динамические использования ключей, например `t("category.#{category.key}")`
|
24
|
-
value: "Значение, интерполируется с %{value}, %{human_key}, %{value_or_human_key}
|
24
|
+
value: "Значение, интерполируется с %{value}, %{human_key}, %{value_or_human_key}"
|
25
25
|
desc:
|
26
26
|
add_missing: "добавить недостающие ключи к переводам"
|
27
27
|
config: "показать конфигурацию"
|
data/i18n-tasks.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'i18n/tasks/version'
|
@@ -34,7 +33,7 @@ TEXT
|
|
34
33
|
s.require_paths = ['lib']
|
35
34
|
|
36
35
|
s.add_dependency 'erubis'
|
37
|
-
s.add_dependency 'activesupport', '>=
|
36
|
+
s.add_dependency 'activesupport', '>= 4.0.2'
|
38
37
|
s.add_dependency 'easy_translate', '>= 0.5.0'
|
39
38
|
s.add_dependency 'term-ansicolor', '>= 1.3.2'
|
40
39
|
s.add_dependency 'terminal-table', '>= 1.5.1'
|
data/lib/i18n/tasks.rb
CHANGED
data/lib/i18n/tasks/base_task.rb
CHANGED
data/lib/i18n/tasks/cli.rb
CHANGED
@@ -170,7 +170,7 @@ class I18n::Tasks::CLI
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def option_name(flag)
|
173
|
-
flag.detect { |f| f.start_with?('--') }.sub(/\A
|
173
|
+
flag.detect { |f| f.start_with?('--') }.sub(/\A--(\[no-\])?/, '').sub(/[^\-\w].*\z/, '').to_sym
|
174
174
|
end
|
175
175
|
|
176
176
|
def try_call(v)
|
@@ -47,22 +47,10 @@ module I18n::Tasks
|
|
47
47
|
args: [:locales, :out_format, arg(:value) + [{default: '%{value_or_human_key}'}]]
|
48
48
|
|
49
49
|
def add_missing(opt = {})
|
50
|
-
|
51
|
-
locales = (opt[:locales] || i18n.locales)
|
52
|
-
if locales[0] == i18n.base_locale
|
53
|
-
# Merge base locale first, as this may affect the value for the other locales
|
54
|
-
forest = i18n.missing_keys({locales: [locales[0]]}.update(opt.slice(:types, :base_locale))).
|
55
|
-
set_each_value!(opt[:value])
|
56
|
-
i18n.data.merge! forest
|
57
|
-
added.merge! forest
|
58
|
-
locales = locales[1..-1]
|
59
|
-
end
|
60
|
-
forest = i18n.missing_keys({locales: locales}.update(opt.slice(:types, :base_locale))).
|
61
|
-
set_each_value!(opt[:value])
|
50
|
+
forest = i18n.missing_keys(opt).set_each_value!(opt[:value])
|
62
51
|
i18n.data.merge! forest
|
63
|
-
added
|
64
|
-
|
65
|
-
print_forest added, opt
|
52
|
+
log_stderr t('i18n_tasks.add_missing.added', count: forest.leaves.count)
|
53
|
+
print_forest forest, opt
|
66
54
|
end
|
67
55
|
end
|
68
56
|
end
|
@@ -5,18 +5,17 @@ module I18n::Tasks
|
|
5
5
|
include Command::Collection
|
6
6
|
|
7
7
|
arg :strict,
|
8
|
-
'-
|
9
|
-
'--strict',
|
8
|
+
'--[no-]strict',
|
10
9
|
t('i18n_tasks.cmd.args.desc.strict')
|
11
10
|
|
12
11
|
cmd :find,
|
13
12
|
pos: '[pattern]',
|
14
13
|
desc: t('i18n_tasks.cmd.desc.find'),
|
15
|
-
args: [:out_format, :pattern]
|
14
|
+
args: [:out_format, :pattern, :strict]
|
16
15
|
|
17
16
|
def find(opt = {})
|
18
17
|
opt[:filter] ||= opt.delete(:pattern) || opt[:arguments].try(:first)
|
19
|
-
print_forest i18n.used_tree(key_filter: opt[:filter].presence
|
18
|
+
print_forest i18n.used_tree(strict: opt[:strict], key_filter: opt[:filter].presence), opt, :used_keys
|
20
19
|
end
|
21
20
|
|
22
21
|
cmd :unused,
|
@@ -25,7 +24,7 @@ module I18n::Tasks
|
|
25
24
|
args: [:locales, :out_format, :strict]
|
26
25
|
|
27
26
|
def unused(opt = {})
|
28
|
-
forest = i18n.unused_keys(opt)
|
27
|
+
forest = i18n.unused_keys(opt.slice(:locales, :strict))
|
29
28
|
print_forest forest, opt, :unused_keys
|
30
29
|
:exit_1 unless forest.empty?
|
31
30
|
end
|
@@ -36,7 +35,7 @@ module I18n::Tasks
|
|
36
35
|
args: [:locales, :out_format, :strict, :confirm]
|
37
36
|
|
38
37
|
def remove_unused(opt = {})
|
39
|
-
unused_keys = i18n.unused_keys(opt)
|
38
|
+
unused_keys = i18n.unused_keys(opt.slice(:locales, :strict))
|
40
39
|
if unused_keys.present?
|
41
40
|
terminal_report.unused_keys(unused_keys)
|
42
41
|
confirm_remove_unused!(unused_keys, opt)
|
@@ -36,18 +36,11 @@ module I18n::Tasks
|
|
36
36
|
if vals == %w(all) || vals.blank?
|
37
37
|
context.locales
|
38
38
|
else
|
39
|
-
|
39
|
+
vals.map { |v| v == 'base' ? context.base_locale : v }
|
40
40
|
end.tap do |locales|
|
41
41
|
locales.each { |locale| validate! locale }
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
45
|
-
def move_base_locale_to_front!(locales, base_locale)
|
46
|
-
if (pos = locales.index(base_locale)) && pos > 0
|
47
|
-
locales[pos], locales[0] = locales[0], locales[pos]
|
48
|
-
end
|
49
|
-
locales
|
50
|
-
end
|
51
44
|
end
|
52
45
|
end
|
53
46
|
end
|
@@ -1,10 +1,14 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
module I18n
|
3
2
|
module Tasks
|
4
3
|
# When this type of error is caught:
|
5
4
|
# 1. show error message of the backtrace
|
6
5
|
# 2. exit with non-zero exit code
|
7
6
|
class CommandError < StandardError
|
7
|
+
|
8
|
+
def initialize(error = nil, message)
|
9
|
+
super(message)
|
10
|
+
set_backtrace error.backtrace
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|