missing-i18n-highlighter 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/missing/i18n/highlighter.rb +9 -0
- data/lib/missing/i18n/highlighter/engine.rb +10 -0
- data/lib/missing/i18n/highlighter/version.rb +7 -0
- data/missing-i18n-highlighter.gemspec +26 -0
- data/vendor/assets/javascripts/missing_i18n_highlighter.js +63 -0
- data/vendor/assets/stylesheets/missing_i18n_highlighter.css +48 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 732f295e7b0048006cc2151fcd1079320c62a9c5
|
4
|
+
data.tar.gz: db4f9869a6c20a4d00fc0469ec1d2a373cdb1673
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4afe9df0d15bad388ac61f409436e6b4d7b68a5843002bfeafc1a9fc0b29f93eeaea187f95910c6d340ad3335ceb59394255bd0cb88c8a8ba2a6655383b63759
|
7
|
+
data.tar.gz: 3501f6e1858b609d87530dbb1c2b8c62b6f5b547353bda2713684d5b3c2588ea926c3a5a346fd2e6de07d6ef649934f6f6fcefecbbe38dd3345ffa38adfccbb9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
missing-i18n-highlighter (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (10.5.0)
|
10
|
+
|
11
|
+
PLATFORMS
|
12
|
+
ruby
|
13
|
+
|
14
|
+
DEPENDENCIES
|
15
|
+
bundler (~> 1.16)
|
16
|
+
missing-i18n-highlighter!
|
17
|
+
rake (~> 10.0)
|
18
|
+
|
19
|
+
BUNDLED WITH
|
20
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Abhishek kanojia
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Missing::I18n::Highlighter
|
2
|
+
|
3
|
+
Missing::I18n::Highlighter highlights missing translations on page with color provided as parameter. Default color is `#729adb` which is `sky blue`. It also shows a popup over the translation missing.
|
4
|
+
|
5
|
+
## Preview
|
6
|
+
Here is how it highlights page with missing translation:
|
7
|
+
|
8
|
+
![missing-i18n-highlighter](https://github.com/abhishekkanojia/images/raw/master/missing-translation.png)
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'missing-i18n-highlighter'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install missing-i18n-highlighter
|
25
|
+
|
26
|
+
## Require js and css file
|
27
|
+
|
28
|
+
In `application.js`
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
//= require missing_i18n_highlighter
|
32
|
+
```
|
33
|
+
|
34
|
+
and In `application.css`
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
*= require missing_i18n_highlighter
|
38
|
+
```
|
39
|
+
|
40
|
+
## Yeah That's it ! !
|
41
|
+
|
42
|
+
Restart your rails server to see the changes and visit the page you want to highlight missing translations on.
|
43
|
+
|
44
|
+
## Development
|
45
|
+
#### Any new feature you want ??
|
46
|
+
create an issue or create a pull request for your feature.
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
> Make sure you install and configure Js Lint and Align tab to validate js that you write.
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/abhishekkanojia/missing-i18n-highlighter.
|
51
|
+
|
52
|
+
## License
|
53
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "missing/i18n/highlighter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "missing/i18n/highlighter/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "missing-i18n-highlighter"
|
8
|
+
spec.version = Missing::I18n::Highlighter::VERSION
|
9
|
+
spec.authors = ["Abhishek kanojia"]
|
10
|
+
spec.email = ["abhishekka3193@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{ This gem highlights missing translations on page with background color. }
|
13
|
+
spec.description = %q{ This gem highlights missing translations on page with background color. }
|
14
|
+
spec.homepage = 'https://github.com/abhishekkanojia/missing-i18n-highlighter'
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
function MissingI18nHighlighter(data) {
|
2
|
+
var options = data || {};
|
3
|
+
this.showPopup = MissingI18nHighlighter.DEFAULT.popup;
|
4
|
+
this.highlightColor = options.color || MissingI18nHighlighter.DEFAULT.color;
|
5
|
+
this.translationSelector = options.selector || MissingI18nHighlighter.DEFAULT.selector;
|
6
|
+
}
|
7
|
+
|
8
|
+
MissingI18nHighlighter.DEFAULT = {
|
9
|
+
color : '#729adb',
|
10
|
+
selector : '.translation_missing',
|
11
|
+
popup : true
|
12
|
+
};
|
13
|
+
|
14
|
+
MissingI18nHighlighter.POPUP = {
|
15
|
+
message : 'Translation Missing',
|
16
|
+
className : 'popuptext',
|
17
|
+
showClass : 'show',
|
18
|
+
wrapperClass : 'popup'
|
19
|
+
};
|
20
|
+
|
21
|
+
MissingI18nHighlighter.prototype.createPopup = function() {
|
22
|
+
var popUp = document.createElement('span');
|
23
|
+
popUp.innerText = MissingI18nHighlighter.POPUP.message;
|
24
|
+
popUp.setAttribute('class', MissingI18nHighlighter.POPUP.className);
|
25
|
+
popUp.classList.add(MissingI18nHighlighter.POPUP.showClass);
|
26
|
+
return popUp;
|
27
|
+
};
|
28
|
+
|
29
|
+
MissingI18nHighlighter.prototype.addPopup = function(elements) {
|
30
|
+
if(this.showPopup) {
|
31
|
+
var _this = this;
|
32
|
+
elements.forEach(function(element){
|
33
|
+
element.classList.add(MissingI18nHighlighter.POPUP.wrapperClass);
|
34
|
+
element.appendChild(_this.createPopup());
|
35
|
+
});
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
MissingI18nHighlighter.prototype.highlightAll = function(elements) {
|
40
|
+
var _this = this;
|
41
|
+
|
42
|
+
elements.forEach(function(element){
|
43
|
+
element.style.backgroundColor = _this.highlightColor;
|
44
|
+
});
|
45
|
+
this.addPopup(elements);
|
46
|
+
};
|
47
|
+
|
48
|
+
MissingI18nHighlighter.prototype.selectAndHighlight = function() {
|
49
|
+
var elements = document.querySelectorAll(this.translationSelector);
|
50
|
+
this.highlightAll(elements);
|
51
|
+
};
|
52
|
+
|
53
|
+
MissingI18nHighlighter.prototype.init = function() {
|
54
|
+
var _this = this;
|
55
|
+
window.addEventListener('load', function() { _this.selectAndHighlight(); });
|
56
|
+
};
|
57
|
+
|
58
|
+
(function(){
|
59
|
+
|
60
|
+
var highlighter = new MissingI18nHighlighter();
|
61
|
+
highlighter.init();
|
62
|
+
|
63
|
+
})();
|
@@ -0,0 +1,48 @@
|
|
1
|
+
.popup {
|
2
|
+
position: relative;
|
3
|
+
display: inline-block;
|
4
|
+
cursor: pointer;
|
5
|
+
}
|
6
|
+
|
7
|
+
.popup .popuptext {
|
8
|
+
visibility: hidden;
|
9
|
+
width: 160px;
|
10
|
+
font-size: 15px;
|
11
|
+
background-color: #555;
|
12
|
+
color: #fff;
|
13
|
+
text-align: center;
|
14
|
+
border-radius: 6px;
|
15
|
+
padding: 8px 0;
|
16
|
+
position: absolute;
|
17
|
+
z-index: 1;
|
18
|
+
bottom: 125%;
|
19
|
+
left: 50%;
|
20
|
+
margin-left: -80px;
|
21
|
+
}
|
22
|
+
|
23
|
+
.popup .popuptext::after {
|
24
|
+
content: "";
|
25
|
+
position: absolute;
|
26
|
+
top: 100%;
|
27
|
+
left: 50%;
|
28
|
+
margin-left: -5px;
|
29
|
+
border-width: 5px;
|
30
|
+
border-style: solid;
|
31
|
+
border-color: #555 transparent transparent transparent;
|
32
|
+
}
|
33
|
+
|
34
|
+
.popup .show {
|
35
|
+
visibility: visible;
|
36
|
+
-webkit-animation: fadeIn 1s;
|
37
|
+
animation: fadeIn 1s
|
38
|
+
}
|
39
|
+
|
40
|
+
@-webkit-keyframes fadeIn {
|
41
|
+
from {opacity: 0;}
|
42
|
+
to {opacity: 1;}
|
43
|
+
}
|
44
|
+
|
45
|
+
@keyframes fadeIn {
|
46
|
+
from {opacity: 0;}
|
47
|
+
to {opacity:1 ;}
|
48
|
+
}
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: missing-i18n-highlighter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Abhishek kanojia
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: " This gem highlights missing translations on page with background color. "
|
42
|
+
email:
|
43
|
+
- abhishekka3193@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/missing/i18n/highlighter.rb
|
57
|
+
- lib/missing/i18n/highlighter/engine.rb
|
58
|
+
- lib/missing/i18n/highlighter/version.rb
|
59
|
+
- missing-i18n-highlighter.gemspec
|
60
|
+
- vendor/assets/javascripts/missing_i18n_highlighter.js
|
61
|
+
- vendor/assets/stylesheets/missing_i18n_highlighter.css
|
62
|
+
homepage: https://github.com/abhishekkanojia/missing-i18n-highlighter
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.6.11
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: This gem highlights missing translations on page with background color.
|
86
|
+
test_files: []
|