i18n-analyzer 0.1.6 → 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e7739b4e407c76f0c8efb9e59ccc3b76178dbd5348edaefdf58018b76a8c876
|
4
|
+
data.tar.gz: 2420536e39dfb43bf7c8cca4a6a3cafacac874e58261fa9aaeafdcd1c5c5b5a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a64806051331e5026f0a1f2e4d9aa0bcfe9df2fc02e89822ccb56d23587a1c973df545a8a327e5f71b6f2a5f5c402e70e7db4542f2d0467e04ac120e3eba54aa
|
7
|
+
data.tar.gz: 2a5227fe84531bceb67a1ec7537abfc3258a5c7f0e0678c1810ee4b69c43d4fe19c6d7d5b96c24fdc6be2b72358529e7e4c1ba431cfa9aeed01fe0fb8a8e62e1
|
data/README.md
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
# I18n::Analyzer
|
2
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
|
+
RubyGems: <https://rubygems.org/gems/i18n-analyzer>
|
5
|
+
|
4
6
|
## Usage
|
5
7
|
Look at the installation section
|
6
8
|
|
7
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
|
+
|
8
13
|
Add this line to your application's Gemfile:
|
9
14
|
|
10
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
|
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
|
-
|
53
|
-
%
|
54
|
-
%
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
67
|
-
-
|
68
|
-
%
|
69
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
90
|
-
|
91
|
-
%
|
92
|
-
|
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
|
-
|
95
|
-
|
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
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
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-
|
10
|
+
date: 2025-04-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- - "
|
16
|
+
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: '7.0'
|
19
19
|
- - "<"
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - "
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '7.0'
|
29
29
|
- - "<"
|