rosette 0.3.7 → 1.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: 77664caa8f4ae7b278f78749c7974cb2d17decde1502c3e4309d864c656044cf
4
- data.tar.gz: 79947deb6eef847055c160b3352d9a58cea2c74440a1dd96741ecf9a055d6c0d
3
+ metadata.gz: 936afb6536d403eb191c1895cfe6d06733bad8a62a7549a471619c1f363b66a3
4
+ data.tar.gz: 1e63dc9ab3b191928891fc8108ea55a4ac9840774a3f5631d98b2532c81ae89d
5
5
  SHA512:
6
- metadata.gz: 825601237c54467da281b880b8ec607ac780e661db5484d00da8e48802d02a72303ba3153033cc1c015e356b640f88eb23df2547dc0c4806826e36d1834b6942
7
- data.tar.gz: b6a899344bc75ea0aba45afaf98e4fd0c6e33527186ee3ed9e7fa5d3c35499bb78064f70ad305b5cfd3a55029e69b8d3ff96f8bfd5fbba7edfe130e799d29e14
6
+ metadata.gz: 1337ebfb88be2cc70e08fa08f6471b2bdabddc53977ba7d165e2afdab2bfb575baeb68a32b39a262be97e54cbb0b70ca17daba2d4c25ff85692d8dd86572e0fd
7
+ data.tar.gz: 66b2573bd40adc84173fbc504e08a9cfcb6c20cae0b5b567916a0b05d6469d042295e8b60c7d3f4f9acd29177f6e7fb8d8b7446ee7187ae0a9502204f21f03e2
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).
@@ -5,7 +5,7 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <%= stylesheet_link_tag "rosette", media: "all" %>
8
+ <%= stylesheet_link_tag "rosette/style", media: "all" %>
9
9
  </head>
10
10
  <body>
11
11
 
@@ -6,7 +6,7 @@ module Rosette
6
6
  isolate_namespace Rosette
7
7
 
8
8
  initializer "rosette.assets.precompile" do |app|
9
- app.config.assets.precompile += ["rosette.css"]
9
+ app.config.assets.precompile += ["rosette/style.css"]
10
10
  end
11
11
 
12
12
  config.after_initialize do |app|
@@ -10,10 +10,6 @@ class Manager
10
10
  METHOD
11
11
  end
12
12
 
13
- def self.normalize!
14
- I18n::Tasks::CLI.start(["normalize"]) if Rosette.normalize
15
- end
16
-
17
13
  private
18
14
 
19
15
  def initialize(locale, key, translation = nil)
@@ -31,14 +27,14 @@ class Manager
31
27
  updated_translations = deep_merge(stored_translations, new_translation)
32
28
  persist(updated_translations)
33
29
 
34
- Manager.normalize!
30
+ Manager.normalize! if Rosette.normalize
35
31
  end
36
32
 
37
33
  def delete
38
34
  updated_translations = delete_translation(stored_translations, @keys)
39
35
  persist(updated_translations)
40
36
 
41
- Manager.normalize!
37
+ Manager.normalize! if Rosette.normalize
42
38
  end
43
39
 
44
40
  def delete_translation(translations, keys)
@@ -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.7"
5
+ VERSION = "1.0.0"
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Platteeuw
@@ -78,7 +78,7 @@ files:
78
78
  - README.md
79
79
  - Rakefile
80
80
  - app/assets/config/rosette_manifest.js
81
- - app/assets/stylesheets/rosette.css
81
+ - app/assets/stylesheets/rosette/style.css
82
82
  - app/controllers/rosette/application_controller.rb
83
83
  - app/controllers/rosette/translations_controller.rb
84
84
  - app/helpers/rosette/application_helper.rb
@@ -95,7 +95,7 @@ files:
95
95
  - lib/rosette/manager.rb
96
96
  - lib/rosette/version.rb
97
97
  - lib/tasks/rosette_tasks.rake
98
- homepage: https://rubygems.org/gems/rosette
98
+ homepage: https://github.com/alexplatteeuw/rosette
99
99
  licenses:
100
100
  - MIT
101
101
  metadata: {}