rosette 0.3.8 → 2.0.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
2
  SHA256:
3
- metadata.gz: 119e688ed5f44a13eab915bc89cd69ace2415024838f0f928b5de4cdc561b292
4
- data.tar.gz: 86b1ccd2e446d8d73090ac44cbe11c095aa17323340ff9808d743af3667e7d02
3
+ metadata.gz: 1464fde486d9478c5765b59a877146517accc9c4e2b238d4bfc7fb1aea1d9359
4
+ data.tar.gz: ce6466f08528efb58f20120257973a7a128b1e8cfd273c7fdbd786686f83a7b9
5
5
  SHA512:
6
- metadata.gz: 6527a0df8ea7ae365b02f736a15dc89b24d9e00fbee16819d9e0c7a6559979bd57dbf865646172c58440e589fe60bd0c47d5ccbe5a297f508142f0b87a468a24
7
- data.tar.gz: cc0e619f84b0548a752a9dcc0a36fdb2ec9ab92d7fec303613f0d2d9ce9984b98ea3a8a30a519879957bdbcba586d5092ba61dcb7be424183e631ad597550870
6
+ metadata.gz: 9121ce2612f2041cb8c100ff363a610609e435b701d55dcfe836c01c7556528c605d0ca537c13496f4311e5b84dbac0d2838561fc29042e2d8bd64b9b947ab9c
7
+ data.tar.gz: a28a1e033511867b677f76a8ee896c46b2ab48fd4f1d74371173a73806efca23ca995ef7d7284cbea9381800d3d13a3c3bb7e55d608d5342f1c344fda67d46b8
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Rosette
2
2
 
3
- Rosette is a Ruby on Rails engine that helps you add missing translations to your application. If your main app is configured to raise on missing translations, Rosette will catch any `I18n::MissingTranslationData` error and display a form to add the missing translations. The form includes an input for each available locale set by `config.i18n.available_locales`.
3
+ Rosette is a Ruby on Rails engine that helps you add missing translations to your application.
4
+
5
+ If your main app is configured to raise on missing translations, Rosette will catch any `I18n::MissingTranslationData` error and display a form to add the missing translations.
6
+
7
+ The form includes an input for each available locale set by `config.i18n.available_locales`.
4
8
 
5
9
  ## Installation
6
10
 
@@ -31,7 +35,7 @@ and that you explicitly set the available locales:
31
35
  config.i18n.available_locales = [:fr, :en]
32
36
  ```
33
37
 
34
- Whether you currently use or are interested in starting to use [i18n-task to normalize](https://github.com/glebm/i18n-tasks#normalize-data) your locales files, add this initializer:
38
+ Whether you currently use or are interested in starting to use [i18n-task](https://github.com/glebm/i18n-tasks#normalize-data) to normalize your locales files, add this initializer:
35
39
 
36
40
  ```ruby
37
41
  # config/initializers/rosette.rb
@@ -39,6 +43,19 @@ Whether you currently use or are interested in starting to use [i18n-task to nor
39
43
  Rosette.normalize = true
40
44
  ```
41
45
 
46
+ ## Preview
47
+
48
+ This is how you will be able to add your missing translations for each available locale set in `config/application.rb`:
49
+
50
+ <img src="https://raw.githubusercontent.com/alexplatteeuw/rosette/master/preview.png" width="545">
51
+
52
+
53
+ ## CLI
54
+
55
+ This gem also provides a command line interface. Run `bundle exec rosette` to get the list of all the tasks:
56
+
57
+ <img src="https://raw.githubusercontent.com/alexplatteeuw/rosette/master/tasks.png" width="545">
58
+
42
59
  ## License
43
60
 
44
61
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -10,7 +10,7 @@ module Rosette
10
10
  private
11
11
 
12
12
  def add_missing_translation_data(exception)
13
- key = exception.message.sub(/translation missing:.+?\./, "")
13
+ key = exception.message.sub(/translation missing:.+?\./i, "")
14
14
 
15
15
  render_rosette_new(key, request.fullpath)
16
16
  end
@@ -10,10 +10,6 @@ class Manager
10
10
  METHOD
11
11
  end
12
12
 
13
- def self.normalize!
14
- I18n::Tasks::CLI.start(["normalize"])
15
- end
16
-
17
13
  private
18
14
 
19
15
  def initialize(locale, key, translation = nil)
@@ -72,4 +68,24 @@ class Manager
72
68
  key.split(".").map(&:to_sym)
73
69
  end
74
70
 
71
+ class << self
72
+
73
+ def normalize!
74
+ suppress_output do # HACK: disable i18n-tasks logs
75
+ I18n::Tasks::CLI.start(["normalize"])
76
+ end
77
+ end
78
+
79
+ private
80
+
81
+ def suppress_output
82
+ original_stderr = $stderr.clone
83
+ $stderr.reopen(File::NULL, "w")
84
+ yield
85
+ ensure
86
+ $stderr.reopen(original_stderr)
87
+ end
88
+
89
+ end
90
+
75
91
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rosette
4
4
 
5
- VERSION = "0.3.8"
5
+ VERSION = "2.0.0"
6
6
 
7
7
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # desc "Explaining what the task does"
3
4
  # task :rosette do
4
5
  # # Task goes here
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Platteeuw
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: i18n-tasks
@@ -16,28 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 1.0.12
18
+ version: '1.1'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 1.0.12
25
+ version: '1.1'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rails
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: 7.0.0
32
+ version: '8.0'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: 7.0.0
39
+ version: '8.0'
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: tty-prompt
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +57,14 @@ dependencies:
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: 6.0.0
60
+ version: '8.0'
62
61
  type: :development
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: 6.0.0
67
+ version: '8.0'
69
68
  description: Add missing translations from the interface of your application
70
69
  email:
71
70
  - alexplatteeuw@gmail.com
@@ -95,11 +94,10 @@ files:
95
94
  - lib/rosette/manager.rb
96
95
  - lib/rosette/version.rb
97
96
  - lib/tasks/rosette_tasks.rake
98
- homepage: https://rubygems.org/gems/rosette
97
+ homepage: https://github.com/alexplatteeuw/rosette
99
98
  licenses:
100
99
  - MIT
101
100
  metadata: {}
102
- post_install_message:
103
101
  rdoc_options: []
104
102
  require_paths:
105
103
  - lib
@@ -107,15 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
105
  requirements:
108
106
  - - ">="
109
107
  - !ruby/object:Gem::Version
110
- version: '0'
108
+ version: 3.3.0
111
109
  required_rubygems_version: !ruby/object:Gem::Requirement
112
110
  requirements:
113
111
  - - ">="
114
112
  - !ruby/object:Gem::Version
115
113
  version: '0'
116
114
  requirements: []
117
- rubygems_version: 3.4.10
118
- signing_key:
115
+ rubygems_version: 4.0.16
119
116
  specification_version: 4
120
117
  summary: Translations manager
121
118
  test_files: []