locale_kit 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/locale_kit/config.rb +16 -0
- data/lib/locale_kit/engine.rb +13 -3
- data/lib/locale_kit/reloader.rb +13 -0
- data/lib/locale_kit/version.rb +1 -1
- data/lib/locale_kit.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fafe0ff1d4b53488d966dc6ea25f7ba96945eac7
|
4
|
+
data.tar.gz: dba3501d8a7a49aefd76a8b975f64cd93a362e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b228afa982ac0d93bd9bd69326f44ec55d4df3e798d5ba7d1956ab038f815b13c4c9615a2ec97a3b3f2a6a4d1ad2167e35f6a38b7eb06d48b291d971a83a845
|
7
|
+
data.tar.gz: b947476fac25f3d86e90060b0fd5d8d9623ba91d3f91ed102e483a50254493178779d46e4b09b24ae2c5e5c7bbd2238eff3d145eaecc529d96bf4ef2d8897509
|
data/lib/locale_kit/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'singleton'
|
2
4
|
|
3
5
|
class LocaleKit::Config
|
@@ -12,4 +14,18 @@ class LocaleKit::Config
|
|
12
14
|
@logger ||= Rails.logger
|
13
15
|
end
|
14
16
|
attr_writer :logger
|
17
|
+
|
18
|
+
def reload
|
19
|
+
return @reload if instance_variable_defined?(:@reload)
|
20
|
+
|
21
|
+
@reload = Rails.env.development?
|
22
|
+
end
|
23
|
+
attr_writer :reload
|
24
|
+
|
25
|
+
def verbose
|
26
|
+
return @verbose if instance_variable_defined?(:@verbose)
|
27
|
+
|
28
|
+
@verbose = Rails.env.development?
|
29
|
+
end
|
30
|
+
attr_writer :verbose
|
15
31
|
end
|
data/lib/locale_kit/engine.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'locale_kit/reloader'
|
4
|
+
|
3
5
|
class LocaleKit::Engine < ::Rails::Engine
|
4
6
|
isolate_namespace LocaleKit
|
5
7
|
|
6
|
-
config.locale_kit = LocaleKit.config
|
7
|
-
|
8
8
|
generators do |app|
|
9
9
|
Rails::Generators.configure!(app.config.generators)
|
10
10
|
require 'generators/locale_kit/override/action_controller' if defined?(ActionController)
|
@@ -12,7 +12,17 @@ class LocaleKit::Engine < ::Rails::Engine
|
|
12
12
|
require 'generators/locale_kit/override/action_mailer' if defined?(ActionMailer)
|
13
13
|
end
|
14
14
|
|
15
|
-
config.
|
15
|
+
config.locale_kit = LocaleKit.config
|
16
|
+
|
17
|
+
initializer 'draper.setup_action_controller' do
|
18
|
+
ActiveSupport.on_load :action_controller do
|
19
|
+
instance_eval do
|
20
|
+
use(LocaleKit::Reloader) if LocaleKit.config.reload
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
config.after_initialize do |_app|
|
16
26
|
LocaleKit.reload!
|
17
27
|
end
|
18
28
|
end
|
data/lib/locale_kit/version.rb
CHANGED
data/lib/locale_kit.rb
CHANGED
@@ -23,7 +23,7 @@ module LocaleKit
|
|
23
23
|
I18n.load_path = (I18n.load_path + locales).uniq
|
24
24
|
I18n.backend.reload!
|
25
25
|
|
26
|
-
config.logger.try(:info, 'Reloaded locales by LocaleKit')
|
26
|
+
config.logger.try(:info, 'Reloaded locales by LocaleKit') if config.verbose
|
27
27
|
end
|
28
28
|
module_function :reload!
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locale_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- lib/locale_kit.rb
|
137
137
|
- lib/locale_kit/config.rb
|
138
138
|
- lib/locale_kit/engine.rb
|
139
|
+
- lib/locale_kit/reloader.rb
|
139
140
|
- lib/locale_kit/version.rb
|
140
141
|
- lib/tasks/locale_kit_tasks.rake
|
141
142
|
homepage: https://github.com/space-pirates-llc/locale_kit
|