i18n-hygiene 1.0.0 → 1.2.0

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
- SHA1:
3
- metadata.gz: 8a0ed252e0cc76261202f3e8c8224a9d2ba89d82
4
- data.tar.gz: 70f696d78272fc56810a9243d8e12471865ec54f
2
+ SHA256:
3
+ metadata.gz: 3a376e3d788c48be51294d93d96f2e9178c169306e851e407d831d500dc0c639
4
+ data.tar.gz: 687de5abf5a477b437a111f8d0c90787757020878f5bf7590b8e7ce903be14dd
5
5
  SHA512:
6
- metadata.gz: b8226fec6814080e9240c23e6ad77ced8a38e7e301385f40c9f6cc43f5b7c707cfc7447f0fded226b67957c49f0c03ba42700b1e9eb75e4624c26c214cfd24f2
7
- data.tar.gz: a49070ce84895f31cb18ce08936643aa7fcfaea784a79b578654181141e910fc7a3de3d90cc3a3098311bc2d4fda29871dbb07db092aea08b7a3fc85b5b35f8c
6
+ metadata.gz: 51bceedbbd1f4c8b6128259f5418716866eae8615492b2f0dc23da732f0346bb2d562b3649a66fab179a05906c2c2aade4d5b5d72333c33d99214573de7fd903
7
+ data.tar.gz: a90fd0e1c61be2f6b73dde02017c041001968fc5e99fc43d449819416cbf1ad05329dda293bb2a5526f3d6b970897779363ce145875da33706fcab0ab63e8242
@@ -11,7 +11,10 @@ module I18n
11
11
  # Looks for translations which are missing interpolation variables.
12
12
  class MissingInterpolationVariable < Base
13
13
  def run
14
- wrapper = I18n::Hygiene::Wrapper.new(exclude_scopes: config.exclude_scopes)
14
+ wrapper = I18n::Hygiene::Wrapper.new(
15
+ exclude_keys: config.exclude_keys,
16
+ exclude_scopes: config.exclude_scopes
17
+ )
15
18
 
16
19
  wrapper.keys_to_check(config.primary_locale).select do |key|
17
20
  checker = I18n::Hygiene::VariableChecker.new(key, wrapper, config.primary_locale, config.locales)
@@ -12,7 +12,7 @@ module I18n
12
12
  end
13
13
 
14
14
  def used?(key)
15
- i18n_config_key?(key) || fully_qualified_key_used?(key)
15
+ fully_qualified_key_used?(key)
16
16
  end
17
17
 
18
18
  private
@@ -47,10 +47,6 @@ module I18n
47
47
  }.join(" ")
48
48
  end
49
49
 
50
- def i18n_config_key?(key)
51
- key.start_with?("i18n.")
52
- end
53
-
54
50
  def pluralized_key_used?(key)
55
51
  [ "zero", "one", "other" ].include?(key.split(".").last)
56
52
  end
@@ -4,9 +4,6 @@ module I18n
4
4
  # aren't in our control. Can return the i18n keys that **are** in our control,
5
5
  # and therefore are interesting for a variety of reasons.
6
6
  class LocaleTranslations
7
- # This is a default example key in the locale files that is not actually used.
8
- EXAMPLE_KEY = "common.greeting"
9
-
10
7
  # These are i18n keys provided by Rails. We cannot exclude them at the :helpers
11
8
  # scope level because we do have some TC i18n keys scoped within :helpers.
12
9
 
@@ -18,7 +15,7 @@ module I18n
18
15
 
19
16
  def keys_to_check
20
17
  fully_qualified_keys(translations_to_check).reject { |key|
21
- exclude_keys.include?(key) || EXAMPLE_KEY == key
18
+ exclude_keys.include?(key)
22
19
  }.sort
23
20
  end
24
21
 
@@ -37,7 +37,7 @@ module I18n
37
37
  end
38
38
 
39
39
  def rails_variables(string)
40
- string.scan(/%{\S+}/).map { |var_string| var_string.gsub(/[%{}]/, '').to_sym }
40
+ string.scan(/%{\S+?}/).map { |var_string| var_string.gsub(/[%{}]/, '').to_sym }.uniq
41
41
  end
42
42
 
43
43
  def js_variables(string)
metadata CHANGED
@@ -1,37 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-hygiene
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eleanor Kiefel Haggerty
8
8
  - Keith Pitty
9
9
  - Nick Browne
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-26 00:00:00.000000000 Z
13
+ date: 2021-11-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '0.6'
22
19
  - - ">="
23
20
  - !ruby/object:Gem::Version
24
21
  version: 0.6.9
22
+ - - "<"
23
+ - !ruby/object:Gem::Version
24
+ version: '2'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
- - - "~>"
30
- - !ruby/object:Gem::Version
31
- version: '0.6'
32
29
  - - ">="
33
30
  - !ruby/object:Gem::Version
34
31
  version: 0.6.9
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '2'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: parallel
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +139,7 @@ homepage: https://github.com/conversation/i18n-hygiene
139
139
  licenses:
140
140
  - MIT
141
141
  metadata: {}
142
- post_install_message:
142
+ post_install_message:
143
143
  rdoc_options:
144
144
  - "--title"
145
145
  - i18n-hygiene documentation
@@ -158,9 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.5.2
163
- signing_key:
161
+ rubygems_version: 3.0.3
162
+ signing_key:
164
163
  specification_version: 4
165
164
  summary: A linter for translation data in ruby applications
166
165
  test_files: []