i18n-analyzer 0.1.4 → 0.1.6

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: 255b1f3168f1d7932b51a42d4b60a7d991326f5ed02f18a350eef0c31d81ceb1
4
- data.tar.gz: 309b2dd4417f8571a0d0d062db1f9c68d897ecd1b69c10df48cd28f955b5579c
3
+ metadata.gz: 7c3e5ce6da62761df10c1188780f4b3bec3229ccd087d2dd6ad51ae391055048
4
+ data.tar.gz: 219b86fd91b21b98fa9408098629514b97f7f4a05203c7f9621629b670d427bf
5
5
  SHA512:
6
- metadata.gz: 630a1fdceff14158832ae9a62d95f7fe37b2a01bb9a4ae81ae153396667b795b6651d1706cf3e5c8e77ea8359d245667eeba8be7331f7d33fe64357013e208b7
7
- data.tar.gz: be1780bf285a2b972941d5fe0668a2ace47a490baebe015ff87c76748bbac65e971ecb6285bca1e1d0726d2df9641e32e3f23d21418ebc76ead1f4988aebd602
6
+ metadata.gz: c8472c6532a5a6853f4db0b459ae9d20aa77645578b356edaa498f4ab5f251e3747a3eb9ed1c9d6e4ce2a6d652c9865d3c7904192b1b5012ad8f3ee0c4322935
7
+ data.tar.gz: 9ade08634b7308029865e72dee082f48d422f36bb500715e3bbfed49a273e2280c692019868794fca743c0992da756e79384ff70dbf3ce17d5e96ac0bf4a709a
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # I18n::Analyzer
2
- I18n-Analyzer is a small and mountable gem developed by open-circle-ltd for analyzing I18n translations. It gives you an additional page, where you can exactly see, what is translated and what is still missing, from model classes to its fields.
2
+ I18n-Analyzer is a small and mountable gem developed by open-circle-ltd for analyzing I18n translations. It gives you an additional page, where you can exactly see, which model classes are translated and which fields of those model classes are still missing.
3
3
 
4
4
  ## Usage
5
5
  Look at the installation section
@@ -18,13 +18,9 @@ mount I18n::Analyzer::Engine, at: '/analyzer'
18
18
  ```
19
19
  it is also possible to create another link, if it is necessary
20
20
 
21
- ### Security Note
22
- If the analyzer is being mounted, it is recommended to safeguard it by mounting the analyzer in a protected namespace, an example would look like this in routes.rb:
23
- ```ruby
24
- authenticate :admin do
25
- # other mountable apps, not visible for the world
26
- mount I18n::Analyzer::Engine, at: '/analyzer'
27
- end
21
+ Or install it yourself as:
22
+ ```bash
23
+ $ gem install i18n-analyzer
28
24
  ```
29
25
 
30
26
  And then execute:
@@ -32,10 +28,13 @@ And then execute:
32
28
  $ bundle
33
29
  ```
34
30
 
35
-
36
- ~~Or install it yourself as:~~ Not working for now, gem has to be yet published
37
- ```bash
38
- $ gem install i18n-analyzer
31
+ ### Security Note
32
+ If the analyzer is being mounted, it is recommended to safeguard it by mounting the analyzer in a protected namespace, an example would look like this in routes.rb:
33
+ ```ruby
34
+ authenticate :admin do
35
+ # other mountable apps, not visible for the world
36
+ mount I18n::Analyzer::Engine, at: '/analyzer'
37
+ end
39
38
  ```
40
39
 
41
40
  ## Using Library locally
@@ -1,5 +1,8 @@
1
1
  module I18n::Analyzer
2
2
  class AnalyzersController < ApplicationController
3
- def index; end
3
+ def index
4
+ Rails.application.eager_load! if Rails.env.development?
5
+ @models = ApplicationRecord.descendants
6
+ end
4
7
  end
5
8
  end
@@ -1,25 +1,69 @@
1
- -# TODO: implement bootstrap to replace css
2
- -# NOTE: CSS was implemented to make the functionality presentable. Please do not roast this css
1
+ -# NOTE: CSS was implemented to make the functionality presentable and readable. Please do not roast this css
3
2
  :css
4
- *{ font-family: sans-serif; text-align: center; margin-left: auto; margin-right: auto;} .analyzer-table {font-family: Arial, Helvetica, sans-serif; border-collapse: collapse; width: 60%;} .analyzer-table td, .analyzer-table th {border: 1px solid #ddd; padding: 8px;} .analyzer-table th {padding-top: 12px;padding-bottom: 12px;text-align: center;background-color: #0d3862;color: white;} .no-translation{background-color: #c12917; color: white;}
3
+ body {
4
+ text-align: left;
5
+ }
6
+ *{ font-family: sans-serif;
7
+ /*margin-left: auto;*/
8
+ /* margin-right: auto; */
9
+ }
10
+
11
+ .analyzer-table {
12
+ font-family: Arial, Helvetica, sans-serif;
13
+ border-collapse: collapse;
14
+
15
+ margin-left: auto;
16
+ margin-right: auto;
17
+
18
+ /*width: 60%;*/
19
+ /*background-color: chartreuse;*/
20
+ background-color: #cce1dc;
21
+ }
22
+
23
+ .analyzer-table td, .analyzer-table th {
24
+ border: 1px solid #ddd;
25
+ padding: 8px;
26
+ }
27
+
28
+ .analyzer-table th {
29
+ padding-top: 12px;
30
+ padding-bottom: 12px;
31
+ background-color: #0d3862;
32
+ color: white;
33
+ }
34
+
35
+ .analyzer-table th a {
36
+ color: white;
37
+ text-decoration: none;
38
+ }
39
+
40
+ .text-center {
41
+ text-align: center;
42
+ }
43
+ .text-right {
44
+ text-align: right;
45
+ }
46
+ .no-translation {
47
+ background-color: #f3d4d1; }
48
+ /*#cce1dc*/
49
+
50
+ %h1.text-center ActiveRecord Translations
5
51
 
6
- %h1 I18N - ActiveRecord Debug
7
- - Rails.application.eager_load! if Rails.env.development?
8
- - models = ApplicationRecord.descendants
9
52
  %table.analyzer-table
10
53
  %tr
11
- %th
12
- %th{colspan: 2} DE
13
- %th{colspan: 2} EN
54
+ %th.text-center Model
55
+ %th.text-center{colspan: 2} DE
56
+ %th.text-center{colspan: 2} EN
14
57
  %tr
15
- %th Model
16
- %th Singular
17
- %th Plural
18
- %th Singular
19
- %th Plural
20
- - models.sort_by { |i| i.name }.each do |model|
58
+ %th
59
+ %th.text-center Singular
60
+ %th.text-center Plural
61
+ %th.text-center Singular
62
+ %th.text-center Plural
63
+
64
+ - @models.sort_by { |i| i.name }.each do |model|
21
65
  %tr
22
- %th= model.name
66
+ %th.text-right= link_to model.name, "#model-#{model.name}"
23
67
  - I18n.with_locale(:de) do
24
68
  %td{class: "#{'no-translation' if model.model_name.human(count: 1, default: '').empty?}"}
25
69
  = model.model_name.human(count: 1)
@@ -32,17 +76,17 @@
32
76
  %td{class: "#{'no-translation' if model.model_name.human(count: 99, default: '').empty?}"}
33
77
  = model.model_name.human(count: 99)
34
78
 
35
- - models.sort_by { |i| i.name }.each do |model|
36
- %h2= model.name
79
+ - @models.sort_by { |i| i.name }.each do |model|
80
+ %h2.text-center{id: "model-#{model.name}"}= model.name
37
81
  %table.analyzer-table
38
82
  %tr
39
- %th Attribute
83
+ %th.text-right Attribute
40
84
  -# TODO: make it, that it reads out the languages from the project and then it loops through the languages
41
- %th DE
42
- %th EN
85
+ %th.text-center DE
86
+ %th.text-center EN
43
87
  - model.new.attributes.sort_by { |i| i }.each do |atr, _value|
44
88
  %tr
45
- %th= atr
89
+ %th.text-right= atr
46
90
  - I18n.with_locale(:de) do
47
91
  %td{class: "#{'no-translation' if model.human_attribute_name(atr, default: '').empty?}"}
48
92
  = model.human_attribute_name(atr)
@@ -1,6 +1,6 @@
1
1
  module I18n
2
2
  # TODO: make versioning dynamically with semantic release
3
3
  module Analyzer
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.6"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - opencircle-operator
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-12 00:00:00.000000000 Z
10
+ date: 2025-03-21 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -16,9 +16,9 @@ dependencies:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
18
  version: '7.0'
19
- - - ">="
19
+ - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: 7.0.1
21
+ version: '9'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,29 +26,29 @@ dependencies:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '7.0'
29
- - - ">="
29
+ - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: 7.0.1
31
+ version: '9'
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: haml
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - "~>"
37
- - !ruby/object:Gem::Version
38
- version: '5'
39
36
  - - ">="
40
37
  - !ruby/object:Gem::Version
41
- version: 5.1.4
38
+ version: '5.0'
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: '7.0'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '5'
49
46
  - - ">="
50
47
  - !ruby/object:Gem::Version
51
- version: 5.1.4
48
+ version: '5.0'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '7.0'
52
52
  description: I18n-Analyzer is a small and mountable gem developed by open-circle-ltd
53
53
  for analyzing I18n translations. It gives you an additional page, where you can
54
54
  exactly see, what is translated and what is still missing, from model classes to
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.6.2
94
+ rubygems_version: 3.6.6
95
95
  specification_version: 4
96
96
  summary: A mountable gem for analyzing I18n translations in your rails application.
97
97
  test_files: []