i18n-tasks 0.9.1 → 0.9.2
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/README.md +5 -0
- data/lib/i18n/tasks/locale_pathname.rb +2 -2
- data/lib/i18n/tasks/scanners/ruby_ast_scanner.rb +4 -1
- data/lib/i18n/tasks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0b8ce2a23eb7fc9f59cdc7b993e17a0a1f4eb29
|
4
|
+
data.tar.gz: aedad8826903bf2d429f7486dcea8cbdf2b2492d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42fb46c4e26ef0f09bdf641b332110b43c43caa3a402371d334e54773cdfa31cfc48da0a5c5fcd7b8baad0695519071aeab4634fec85065a3733e6bcc8e0fbe6
|
7
|
+
data.tar.gz: 0be2ce49e12dc3f2f77222cd8028dcd04de5584435c859bed50a60dcee3c3c685aeb5878c8e5d5959baecf4b91ff1999ec71f93a5f13ab969871ed7fd8c4df41
|
data/README.md
CHANGED
@@ -172,6 +172,8 @@ I encourage you to mark these with [i18n-tasks-use hints](#fine-tuning).
|
|
172
172
|
|
173
173
|
Alternatively, you can enable dynamic key inference by setting `search.strict` to `false` in the config. In this case,
|
174
174
|
all the dynamic parts of the key will be considered used, e.g. `cats.tenderlove.name` would not be reported as unused.
|
175
|
+
Note that only one section of the key is treated as a wildcard for each string interpolation; i.e. in this example,
|
176
|
+
`cats.tenderlove.special.name` *will* be reported as unused.
|
175
177
|
|
176
178
|
## Configuration
|
177
179
|
|
@@ -234,6 +236,9 @@ data:
|
|
234
236
|
- 'config/locales/%{locale}.yml'
|
235
237
|
```
|
236
238
|
|
239
|
+
If you want to have i18n-tasks reorganize your existing keys using `data.write`, either set the router to
|
240
|
+
`pattern_router` as above, or run `i18n-tasks normalize -p` (forcing the use of the pattern router for that run).
|
241
|
+
|
237
242
|
##### Key pattern syntax
|
238
243
|
|
239
244
|
A special syntax similar to file glob patterns is used throughout i18n-tasks to match translation keys:
|
@@ -3,13 +3,13 @@ module I18n::Tasks
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def replace_locale(path, from, to)
|
6
|
-
path && path.
|
6
|
+
path && path.gsub(path_locale_re(from), to)
|
7
7
|
end
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def path_locale_re(locale)
|
12
|
-
(@path_locale_res ||= {})[locale] ||= /(?<=^|[\/.])#{locale}(
|
12
|
+
(@path_locale_res ||= {})[locale] ||= /(?<=^|[\/.])#{locale}(?=[\/.])/.freeze
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -32,7 +32,10 @@ module I18n::Tasks::Scanners
|
|
32
32
|
end
|
33
33
|
|
34
34
|
magic_comments = comments.select { |comment| comment.text =~ MAGIC_COMMENT_PREFIX }
|
35
|
-
comment_to_node = Parser::Source::Comment.associate_locations(ast, magic_comments).
|
35
|
+
comment_to_node = Parser::Source::Comment.associate_locations(ast, magic_comments).tap do |h|
|
36
|
+
# transform_values is only available in ActiveSupport 4.2+
|
37
|
+
h.each { |k, v| h[k] = v.first }
|
38
|
+
end.invert
|
36
39
|
results + magic_comments.flat_map do |comment|
|
37
40
|
@parser.reset
|
38
41
|
associated_node = comment_to_node[comment]
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|