i18n-tasks 0.9.35 → 0.9.36

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
  SHA256:
3
- metadata.gz: 8ac03642fdf45424834ce7e968e70af9d602c5d5721eda666dbd38635adcf542
4
- data.tar.gz: 793b43903d97f1dccead925e5128142886708b279f55f04bcd62c6b349bddead
3
+ metadata.gz: cde1b3151cfb69975e8512b714de8707a8ad79a7dd38ec299a282450297399f9
4
+ data.tar.gz: f98141b89b24a49b163823af6351476024b1a676d0b89a781c49dc3a10ffc1a7
5
5
  SHA512:
6
- metadata.gz: 538b6490808142df807dcfa623e6907dd408dc9346e37b2ecbba2257350fa6dcf91b66f8b1f9338cc24fbd7f138ee5c20a7875633c26c9c06ac06dbb87e7e67a
7
- data.tar.gz: f7570702d3599d229236ffd3841b33776b3bef50875b12c515b5bc3e63ace2ef2f86fd3058e957959e196c90ace5dc539a5b328a203f0e9f4460b26f3b751778
6
+ metadata.gz: 364b4d1d23802bfbabab3c41c7c39677f263925459f6be39c1e746e1f07221bfb487b1dbc425e8643ebacaaa20b35c3f08eb5d00fabe7237b35556a30759a67b
7
+ data.tar.gz: 9c7889833088afd77d439cc3517b99f01100cb507ca329ce30b36193054c5747b98e7fae2b972d006daa6c9973376da02c8c137ff26471fe758409677d7cdc02
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coverage]][coverage] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/glebm/i18n-tasks?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
+ # i18n-tasks [![Build Status][badge-ci]][ci] [![Coverage Status][badge-coverage]][coverage] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/glebm/i18n-tasks?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
2
 
3
3
  i18n-tasks helps you find and manage missing and unused translations.
4
4
 
@@ -22,7 +22,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
22
22
  Add i18n-tasks to the Gemfile:
23
23
 
24
24
  ```ruby
25
- gem 'i18n-tasks', '~> 0.9.35'
25
+ gem 'i18n-tasks', '~> 0.9.36'
26
26
  ```
27
27
 
28
28
  Copy the default [configuration file](#configuration):
@@ -435,8 +435,8 @@ Tasks that come with the gem are defined in [lib/i18n/tasks/command/commands](li
435
435
  Custom tasks can be added easily, see the examples [on the wiki](https://github.com/glebm/i18n-tasks/wiki#custom-tasks).
436
436
 
437
437
  [MIT license]: /LICENSE.txt
438
- [travis]: https://travis-ci.org/glebm/i18n-tasks
439
- [badge-travis]: https://img.shields.io/travis/glebm/i18n-tasks.svg
438
+ [ci]: https://github.com/glebm/i18n-tasks/actions/workflows/tests.yml
439
+ [badge-ci]: https://github.com/glebm/i18n-tasks/actions/workflows/tests.yml/badge.svg
440
440
  [coverage]: https://codeclimate.com/github/glebm/i18n-tasks
441
441
  [badge-coverage]: https://api.codeclimate.com/v1/badges/5d173e90ada8df07cedc/test_coverage
442
442
  [config]: https://github.com/glebm/i18n-tasks/blob/master/templates/config/i18n-tasks.yml
@@ -8,6 +8,7 @@ ru:
8
8
  default_text: 'По умолчанию: %{value}'
9
9
  desc:
10
10
  all_locales: Не ожидать, что маски ключа начинаются с локали. Применять маски ко всем локалям.
11
+ config: Путь к файлу конфигурации
11
12
  confirm: Подтвердить автоматом
12
13
  data_format: 'Формат данных: %{valid_text}.'
13
14
  keep_order: Keep the order of the keys
@@ -39,7 +39,7 @@ module I18n
39
39
  include Data
40
40
  include Stats
41
41
 
42
- def initialize(config = {}, config_file: nil)
42
+ def initialize(config_file: nil, **config)
43
43
  @config_override = config_file
44
44
  self.config = config || {}
45
45
  end
@@ -9,7 +9,7 @@ module I18n::Tasks
9
9
  include Command::DSL
10
10
 
11
11
  DATA_FORMATS = %w[yaml json keys].freeze
12
- OUT_FORMATS = ['terminal-table', *DATA_FORMATS, 'inspect'].freeze
12
+ OUT_FORMATS = ['terminal-table', *DATA_FORMATS, 'inspect', 'key-values'].freeze
13
13
 
14
14
  format_arg = proc do |type, values|
15
15
  default = values.first
@@ -85,6 +85,8 @@ module I18n::Tasks
85
85
  puts forest.inspect
86
86
  when 'keys'
87
87
  puts forest.key_names(root: true)
88
+ when 'key-values'
89
+ puts forest.key_values(root: true).map { |kv| kv.join("\t") }
88
90
  when *DATA_FORMATS
89
91
  puts i18n.data.adapter_dump forest.to_hash(true), format
90
92
  end
@@ -2,10 +2,12 @@
2
2
 
3
3
  module I18n::Tasks::Scanners
4
4
  module RubyKeyLiterals
5
- LITERAL_RE = /:?".+?"|:?'.+?'|:\w+/.freeze
5
+ # NOTE
6
+ # "#{double_quoted["hash_pattern"]}" | "#{double_quoted_pattern}" | 'single_quoted_pattern' | :symbol_pattern
7
+ LITERAL_RE = /:?"[^\[]+\["[^"]+"\].+"|:?".+?"|:?'.+?'|:\w+/.freeze
6
8
 
7
9
  # Match literals:
8
- # * String: '', "#{}"
10
+ # * String: '', "#{}", "#{hash["key"]}"
9
11
  # * Symbol: :sym, :'', :"#{}"
10
12
  def literal_re
11
13
  LITERAL_RE
@@ -20,7 +22,7 @@ module I18n::Tasks::Scanners
20
22
  literal
21
23
  end
22
24
 
23
- VALID_KEY_CHARS = /(?:[[:word:]]|[-.?!:;À-ž])/.freeze
25
+ VALID_KEY_CHARS = /(?:[[:word:]]|[-.?!:;À-ž\/'"\[\]])/.freeze
24
26
  VALID_KEY_RE = /^#{VALID_KEY_CHARS}+$/.freeze
25
27
 
26
28
  def valid_key?(key)
@@ -27,7 +27,7 @@ module I18n::Tasks
27
27
 
28
28
  ALWAYS_EXCLUDE = %w[*.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
29
29
  *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus
30
- *.webp].freeze
30
+ *.webp *.map].freeze
31
31
 
32
32
  # Find all keys in the source and return a forest with the keys in absolute form and their occurrences.
33
33
  #
@@ -2,6 +2,6 @@
2
2
 
3
3
  module I18n
4
4
  module Tasks
5
- VERSION = '0.9.35'
5
+ VERSION = '0.9.36'
6
6
  end
7
7
  end
data/lib/i18n/tasks.rb CHANGED
@@ -43,19 +43,18 @@ module I18n
43
43
  end
44
44
  end
45
45
 
46
+ # Per https://github.com/rails/rails/commit/0181f0edd57a2149278bd59c3519233ca1e0a413#commitcomment-60940992
47
+ # 'active_support' must be required first even if we only use parts of it.
48
+ require 'active_support'
49
+
46
50
  require 'active_support/inflector'
47
51
  require 'active_support/core_ext/hash'
48
52
  require 'active_support/core_ext/array/access'
49
53
  require 'active_support/core_ext/array/extract_options'
50
54
  require 'active_support/core_ext/module/delegation'
51
55
  require 'active_support/core_ext/object/blank'
52
- begin
53
- # activesupport >= 3
54
- require 'active_support/core_ext/object/try'
55
- rescue LoadError => _e
56
- # activesupport ~> 2.3.2
57
- require 'active_support/core_ext/try'
58
- end
56
+ require 'active_support/core_ext/object/try'
57
+
59
58
  require 'rainbow'
60
59
  require 'erubi'
61
60
 
@@ -72,7 +72,7 @@ search:
72
72
  # -
73
73
 
74
74
  ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
75
- ## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
75
+ ## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json *.map)
76
76
  exclude:
77
77
  - app/assets/images
78
78
  - app/assets/fonts
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.35
4
+ version: 0.9.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebm
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-06 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -416,8 +416,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
416
416
  - !ruby/object:Gem::Version
417
417
  version: '0'
418
418
  requirements: []
419
- rubygems_version: 3.1.2
420
- signing_key:
419
+ rubygems_version: 3.2.3
420
+ signing_key:
421
421
  specification_version: 4
422
422
  summary: Manage localization and translation with the awesome power of static analysis
423
423
  test_files: []