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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3eec8659815b53951e2445dbeec09cb9f346c3e2
4
- data.tar.gz: 50d5412e21b40b89220852f4cdb45a92d40acdc3
3
+ metadata.gz: d0b8ce2a23eb7fc9f59cdc7b993e17a0a1f4eb29
4
+ data.tar.gz: aedad8826903bf2d429f7486dcea8cbdf2b2492d
5
5
  SHA512:
6
- metadata.gz: c146fec3dd23aa4de882f510d781c8a64ae189fe3c2a6520b84ec27d46add3f8030a0705ddf3b60ee63f143c40c031f20cb5dc93baa2783079bbf44c1f9d6f5b
7
- data.tar.gz: 5f79e425a080e8824d5f85ae77f98a8e81b086989b5ced527e2e83f552f0ce9b4e798d3ef137c922c5e1b7ae16b110b487c11b1a4883281be28bace1cf1d880a
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.sub(path_locale_re(from), to)
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}(?=\.)/.freeze
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).transform_values(&:first).invert
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]
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Tasks
3
- VERSION = '0.9.1'
3
+ VERSION = '0.9.2'
4
4
  end
5
5
  end
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.1
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-02 00:00:00.000000000 Z
11
+ date: 2015-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport