isomorfeus-i18n 22.9.0.rc1 → 22.9.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/i18n/enhancer.rb +1 -3
- data/lib/isomorfeus/i18n/init.rb +1 -24
- data/lib/isomorfeus/i18n/reducer.rb +1 -3
- data/lib/isomorfeus/i18n/version.rb +1 -1
- data/lib/isomorfeus-i18n.rb +1 -2
- data/lib/lucid_i18n_mixin.rb +1 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da2d72a216e3b42416b741c5135ef4cc4abace851c6f0d52c4d2f312fc246b1
|
4
|
+
data.tar.gz: d20f330be1b5f50f215fd21e1fe5d79a17cad3a35c28f66f994a3fd5d68d24dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 394751e9d95f3d30e6dc24bd9b785035de3850f0cbe10b6ad5e78604f0a7d17351b6ee35353bea3309d8ba2db12992a08cc06002717a250d932cca6f6d8037c8
|
7
|
+
data.tar.gz: 9c72c1d20e74016d7df24a3789acdca8d603397a221589f5151f00a4450df3cb3cc687f005029866016bb3ff5bcf9fbf5c485b83a1f9f34d7cedb265b34f289f
|
@@ -34,14 +34,12 @@ module Isomorfeus
|
|
34
34
|
end
|
35
35
|
elsif action[:type] == 'I18N_INIT'
|
36
36
|
locale = action[:locale]
|
37
|
-
available_locales = FastGettext.available_locales
|
38
|
-
domain = FastGettext.text_domain
|
39
37
|
ne_locale = if Isomorfeus.available_locales.include?(locale)
|
40
38
|
Isomorfeus.current_locale = locale
|
41
39
|
else
|
42
40
|
Isomorfeus.current_locale = Isomorfeus.default_locale
|
43
41
|
end
|
44
|
-
action = { type: 'I18N_MERGE', data: {
|
42
|
+
action = { type: 'I18N_MERGE', data: { domain: Isomorfeus.i18n_domain, locale: ne_locale }}
|
45
43
|
end
|
46
44
|
next_enh.call(action)
|
47
45
|
end
|
data/lib/isomorfeus/i18n/init.rb
CHANGED
@@ -1,33 +1,10 @@
|
|
1
1
|
module Isomorfeus
|
2
2
|
module I18n
|
3
|
-
class StoreInit
|
4
|
-
def self.init
|
5
|
-
root_element = `document.querySelector('div[data-iso-root]')`
|
6
|
-
if root_element
|
7
|
-
Isomorfeus.current_locale = root_element.JS.getAttribute('data-iso-nloc')
|
8
|
-
else
|
9
|
-
Isomorfeus.current_locale = Isomorfeus.default_locale
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
3
|
class Init
|
15
4
|
class << self
|
16
5
|
if RUBY_ENGINE == 'opal'
|
17
6
|
def init
|
18
|
-
|
19
|
-
@initializing = true
|
20
|
-
@initialized = false
|
21
|
-
init_from_server
|
22
|
-
promise { Isomorfeus.store.dig(:i18n_state, :locale) }
|
23
|
-
end
|
24
|
-
|
25
|
-
def init_from_server
|
26
|
-
Isomorfeus.store.deferred_dispatch(type: 'I18N_INIT', locale: Isomorfeus.current_locale)
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialized?
|
30
|
-
@initialized
|
7
|
+
Isomorfeus.current_locale = Isomorfeus.store.dig(:i18n_state, :locale)
|
31
8
|
end
|
32
9
|
else
|
33
10
|
def init
|
@@ -26,9 +26,7 @@ module Isomorfeus
|
|
26
26
|
else # RUBY_ENGINE
|
27
27
|
SERVER_REDUCER = proc do |prev_state, action|
|
28
28
|
action_type = action[:type]
|
29
|
-
if action_type == '
|
30
|
-
action[:set_state]
|
31
|
-
elsif action_type == 'I18N_MERGE'
|
29
|
+
if action_type == 'I18N_MERGE'
|
32
30
|
new_state = prev_state ? prev_state.deep_dup : {}
|
33
31
|
new_state.deep_merge!(action[:data])
|
34
32
|
new_state
|
data/lib/isomorfeus-i18n.rb
CHANGED
@@ -9,8 +9,7 @@ require 'lucid_i18n_mixin'
|
|
9
9
|
require 'isomorfeus/i18n/init'
|
10
10
|
|
11
11
|
if RUBY_ENGINE == 'opal'
|
12
|
-
Isomorfeus.add_client_init_after_store_class_name('Isomorfeus::I18n::
|
13
|
-
Isomorfeus.add_transport_init_class_name('Isomorfeus::I18n::Init')
|
12
|
+
Isomorfeus.add_client_init_after_store_class_name('Isomorfeus::I18n::Init')
|
14
13
|
else
|
15
14
|
require 'active_support'
|
16
15
|
require 'oj'
|
data/lib/lucid_i18n_mixin.rb
CHANGED
@@ -89,6 +89,7 @@ module LucidI18nMixin
|
|
89
89
|
c_name = object.class.to_s
|
90
90
|
options = {} unless options
|
91
91
|
locale = options.delete(:locale) { current_locale }
|
92
|
+
locale = `locale.toString()`
|
92
93
|
options = options.transform_keys { |k| k.camelize(:lower) }
|
93
94
|
if object.is_a?(Numeric)
|
94
95
|
options[:minimumFractionDigits] = 4 unless object.is_a?(Integer)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 22.9.0.
|
4
|
+
version: 22.9.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
@@ -114,28 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 22.9.0.
|
117
|
+
version: 22.9.0.rc3
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 22.9.0.
|
124
|
+
version: 22.9.0.rc3
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: isomorfeus-transport
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 22.9.0.
|
131
|
+
version: 22.9.0.rc3
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 22.9.0.
|
138
|
+
version: 22.9.0.rc3
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: r18n-core
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 22.9.0.
|
159
|
+
version: 22.9.0.rc3
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 22.9.0.
|
166
|
+
version: 22.9.0.rc3
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rake
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|