i18n-tasks 0.9.17 → 0.9.18

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: ebc184ed8233c7a409de36ee6fd654fa4830e2f2
4
- data.tar.gz: c846f15fa5b8e278d4b0dab8b3ec021759b8f603
3
+ metadata.gz: 6c8f584095c296651d391ff4d7bda8f7976ed897
4
+ data.tar.gz: '0886ab5028387f20c2b6a5a246fb9435a7285ce1'
5
5
  SHA512:
6
- metadata.gz: 558d0ee6c04e5630c48f1e1c206f37931a38c60da5ff3392042940c814bfdbbab94ca0a51840f0b963fcd6adab4c9b3e2d4b5d15ee764670a4b49cd444194242
7
- data.tar.gz: 8b955b0dd45d4761a9fde64ef0baa81fa3725d51f72ce136ebbac95c0bedb88a0a8392b1029253d780bf60a33fbaf7c1beb801f6430a9311dbe4d4cfe2a6aa9d
6
+ metadata.gz: 84624f8fda11ae08790761f4e6f2490abe6cd3f04d8783b2e3bfd0e809b40eecaae7dfa6643b6db45e3c92152fedf9ca8e131808295b9ff08469e8c8bfe82c53
7
+ data.tar.gz: 660b804e12dec65e30ccd96f0441fd8eea8fcc0b20a8eb3a64b8fb7e5f5bce18927f45c5fddb8844a058d3d98faaa17a0ae785599b026215a317db3088140e70
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.9.17'
27
+ gem 'i18n-tasks', '~> 0.9.18'
28
28
  ```
29
29
 
30
30
  Copy the default [configuration file](#configuration):
@@ -92,8 +92,12 @@ module I18n::Tasks::Scanners
92
92
  # capture only the first argument
93
93
  /
94
94
  #{translate_call_re} [\( ] \s* (?# fn call begin )
95
- (#{literal_re}) (?# capture the first argument)
95
+ (#{first_argument_re}) (?# capture the first argument)
96
96
  /x
97
97
  end
98
+
99
+ def first_argument_re
100
+ literal_re
101
+ end
98
102
  end
99
103
  end
@@ -32,6 +32,11 @@ module I18n::Tasks::Scanners
32
32
  end
33
33
  end
34
34
 
35
+ # parse expressions with literals and variable
36
+ def first_argument_re
37
+ /(?: (?: #{literal_re} ) | #{variable_re} )/x
38
+ end
39
+
35
40
  # strip literals, convert expressions to #{interpolations}
36
41
  def strip_literal(val)
37
42
  if val =~ /\A\w/
@@ -56,6 +61,12 @@ module I18n::Tasks::Scanners
56
61
  /[\w():"'.\s]+/x
57
62
  end
58
63
 
64
+ # match variable key
65
+ # e.g: t(key, scope: 'scope') => t('scope.#{key}')
66
+ def variable_re
67
+ /\w+/
68
+ end
69
+
59
70
  # extract literal or array of literals
60
71
  # returns nil on any other input
61
72
  # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
@@ -2,6 +2,6 @@
2
2
 
3
3
  module I18n
4
4
  module Tasks
5
- VERSION = '0.9.17'
5
+ VERSION = '0.9.18'
6
6
  end
7
7
  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.17
4
+ version: 0.9.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-10 00:00:00.000000000 Z
11
+ date: 2017-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport