i18n-analyzer 0.1.7 → 0.2.1

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: f73a9a8a8092ac783a6aa139c7ce6566d6b314b6c861cda8360fe8feb7441c67
4
- data.tar.gz: b6f70dd2fc859b006e44419136d7b673067a11e39639620478772e67de876063
3
+ metadata.gz: b4ecefddfdeab786b5b6a40b7f41eb284a9e5264c045ad6b309e069e91b5bffb
4
+ data.tar.gz: 48352aa13a678cfb44bb51f27635ef3a30305a26a7ffee8364e28826ebbade12
5
5
  SHA512:
6
- metadata.gz: 5905bb94b5d8e0d9ddb7f81ed8f436d1eef6ebe8068346327eac11a3fb2d2e5473f5326b294e7de78f9979de1f52cd2aab055bf8fe483bee6f9022e669a33077
7
- data.tar.gz: 958b98769c4b39b817fe3650b6a2d1e6a618fd58f9a586a7f9a3f9458ec313b0d0e18f403f2013f00b5f514d5ed42f8aeef6df302882b890fc44fa883977a118
6
+ metadata.gz: f17f57117e235e2df58a8e7307d1779e62bfe03d4546691410c4939acb16399d69701037e083a8374f22ce1ba9234df944eb1065768ddb6b327a87202e07d7e6
7
+ data.tar.gz: 683848b106c2b6046ee7708af368a410d23a16054e738177827dbc74b82dcb7cac0cbb411432fe3882b4f7b0627d8b1216b9b3878548b792e47adb12c7d48ecf
data/README.md CHANGED
@@ -7,6 +7,9 @@ RubyGems: <https://rubygems.org/gems/i18n-analyzer>
7
7
  Look at the installation section
8
8
 
9
9
  ## Installation
10
+
11
+ Before you start adding the gem to your app, make sure you have I18n.available_locales defined. More information on I18n.available_locales at https://guides.rubyonrails.org/i18n.html#configure-the-i18n-module
12
+
10
13
  Add this line to your application's Gemfile:
11
14
 
12
15
  ```ruby
@@ -1,7 +1,9 @@
1
1
  module I18n::Analyzer
2
+
2
3
  class AnalyzersController < ApplicationController
3
4
  def index
4
5
  Rails.application.eager_load! if Rails.env.development?
6
+ @languages = I18n.available_locales.present? ? I18n.available_locales : [ :en, :de ]
5
7
  @models = ApplicationRecord.descendants
6
8
  end
7
9
  end
@@ -1,4 +1,4 @@
1
- -# NOTE: CSS was implemented to make the functionality presentable and readable. Please do not roast this css
1
+ -# NOTE: CSS was implemented to make the functionality presentable and readable
2
2
  :css
3
3
  body {
4
4
  text-align: left;
@@ -45,52 +45,56 @@
45
45
  }
46
46
  .no-translation {
47
47
  background-color: #f3d4d1; }
48
+
49
+ .card-no-translations-found {
50
+ background-color: #a1d3f7;
51
+ padding: 20px;
52
+ border: 1px solid #1591ea;
53
+ border-radius: 25px;
54
+ width: 22%;
55
+ margin: auto;
56
+ }
48
57
  /*#cce1dc*/
49
58
 
50
59
  %h1.text-center ActiveRecord Translations
51
60
 
52
- %table.analyzer-table
53
- %tr
54
- %th.text-center Model
55
- %th.text-center{colspan: 2} DE
56
- %th.text-center{colspan: 2} EN
57
- %tr
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|
61
+ - if @languages.present?
62
+ %table.analyzer-table
63
+ %tr
64
+ %th.text-center Model
65
+ - @languages.each do |lang|
66
+ %th.text-center{colspan: 2}= lang.upcase
65
67
  %tr
66
- %th.text-right= link_to model.name, "#model-#{model.name}"
67
- - I18n.with_locale(:de) do
68
- %td{class: "#{'no-translation' if model.model_name.human(count: 1, default: '').empty?}"}
69
- = model.model_name.human(count: 1)
70
- %td{class: "#{'no-translation' if model.model_name.human(count: 99, default: '').empty?}"}
71
- = model.model_name.human(count: 99)
68
+ %th
69
+ - @languages.each do
70
+ %th.text-center Singular
71
+ %th.text-center Plural
72
72
 
73
- - I18n.with_locale(:en) do
74
- %td{class: "#{'no-translation' if model.model_name.human(count: 1, default: '').empty?}"}
75
- = model.model_name.human(count: 1)
76
- %td{class: "#{'no-translation' if model.model_name.human(count: 99, default: '').empty?}"}
77
- = model.model_name.human(count: 99)
73
+ - @models.sort_by { |i| i.name }.each do |model|
74
+ %tr
75
+ %th.text-right= link_to model.name, "#model-#{model.name}"
76
+ - @languages.each do |lang|
77
+ - I18n.with_locale(lang.to_sym) do
78
+ %td{class: "#{'no-translation' if model.model_name.human(count: 1, default: '').empty?}"}
79
+ = model.model_name.human(count: 1)
80
+ %td{class: "#{'no-translation' if model.model_name.human(count: 99, default: '').empty?}"}
81
+ = model.model_name.human(count: 99)
78
82
 
79
- - @models.sort_by { |i| i.name }.each do |model|
80
- %h2.text-center{id: "model-#{model.name}"}= model.name
81
- %table.analyzer-table
82
- %tr
83
- %th.text-right Attribute
84
- -# TODO: make it, that it reads out the languages from the project and then it loops through the languages
85
- %th.text-center DE
86
- %th.text-center EN
87
- - model.new.attributes.sort_by { |i| i }.each do |atr, _value|
83
+ - @models.sort_by { |i| i.name }.each do |model|
84
+ %h2.text-center{id: "model-#{model.name}"}= model.name
85
+ %table.analyzer-table
86
+ %tr
87
+ %th.text-right Attribute
88
+ - @languages.each do |lang|
89
+ %th.text-center= lang.upcase
88
90
  %tr
89
- %th.text-right= atr
90
- - I18n.with_locale(:de) do
91
- %td{class: "#{'no-translation' if model.human_attribute_name(atr, default: '').empty?}"}
92
- = model.human_attribute_name(atr)
91
+ - model.new.attributes.sort_by { |i| i }.each do |atr, _value|
92
+ %tr
93
+ %th.text-right= atr
94
+ - @languages.each do |lang|
95
+ - I18n.with_locale(lang.to_sym) do
96
+ %td{class: "#{'no-translation' if model.human_attribute_name(atr, default: '').empty?}"}
97
+ = model.human_attribute_name(atr)
93
98
 
94
- - I18n.with_locale(:en) do
95
- %td{class: "#{'no-translation' if model.human_attribute_name(atr, default: '').empty?}"}
96
- = model.human_attribute_name(atr)
99
+ - else
100
+ .text-center.card-no-translations-found No languages has been detected, it is possible to make this message disappear by implementing a language file in config/locales
@@ -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.7"
4
+ VERSION = "0.2.1"
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.7
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - opencircle-operator
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -15,7 +15,7 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.0'
18
+ version: '7.2'
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '9'
@@ -25,7 +25,7 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '7.0'
28
+ version: '7.2'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
31
  version: '9'
@@ -35,20 +35,20 @@ dependencies:
35
35
  requirements:
36
36
  - - ">="
37
37
  - !ruby/object:Gem::Version
38
- version: '5.0'
38
+ version: '6.0'
39
39
  - - "<"
40
40
  - !ruby/object:Gem::Version
41
- version: '7.0'
41
+ version: '8.0'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '5.0'
48
+ version: '6.0'
49
49
  - - "<"
50
50
  - !ruby/object:Gem::Version
51
- version: '7.0'
51
+ version: '8.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
@@ -84,14 +84,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - ">="
86
86
  - !ruby/object:Gem::Version
87
- version: 3.3.0
87
+ version: 3.4.0
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.6.6
94
+ rubygems_version: 3.6.9
95
95
  specification_version: 4
96
96
  summary: A mountable gem for analyzing I18n translations in your rails application.
97
97
  test_files: []