i18n-analyzer 0.1.7 → 0.2.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: f73a9a8a8092ac783a6aa139c7ce6566d6b314b6c861cda8360fe8feb7441c67
4
- data.tar.gz: b6f70dd2fc859b006e44419136d7b673067a11e39639620478772e67de876063
3
+ metadata.gz: 8e7739b4e407c76f0c8efb9e59ccc3b76178dbd5348edaefdf58018b76a8c876
4
+ data.tar.gz: 2420536e39dfb43bf7c8cca4a6a3cafacac874e58261fa9aaeafdcd1c5c5b5a2
5
5
  SHA512:
6
- metadata.gz: 5905bb94b5d8e0d9ddb7f81ed8f436d1eef6ebe8068346327eac11a3fb2d2e5473f5326b294e7de78f9979de1f52cd2aab055bf8fe483bee6f9022e669a33077
7
- data.tar.gz: 958b98769c4b39b817fe3650b6a2d1e6a618fd58f9a586a7f9a3f9458ec313b0d0e18f403f2013f00b5f514d5ed42f8aeef6df302882b890fc44fa883977a118
6
+ metadata.gz: a64806051331e5026f0a1f2e4d9aa0bcfe9df2fc02e89822ccb56d23587a1c973df545a8a327e5f71b6f2a5f5c402e70e7db4542f2d0467e04ac120e3eba54aa
7
+ data.tar.gz: 2a5227fe84531bceb67a1ec7537abfc3258a5c7f0e0678c1810ee4b69c43d4fe19c6d7d5b96c24fdc6be2b72358529e7e4c1ba431cfa9aeed01fe0fb8a8e62e1
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.0"
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.0
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: 2025-04-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails