isomorfeus-i18n 22.9.0.rc2 → 22.9.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd17e0fdc26a262d57541bace2aa14e2233816c7c3b793744b5ad994ce5eee59
4
- data.tar.gz: 6419e97d934a095e4db04e7ca41a407ba3f3b6d850fdea3c017884d9dd68b56f
3
+ metadata.gz: 03ad11a448d17d9526b877d2ad750d2e95d1203c93e04c5205aac00a9d2508d1
4
+ data.tar.gz: cddd6d7cbe50ceb959a2582efc7b6a479b7257b08ca45ee27581c8b78176b23e
5
5
  SHA512:
6
- metadata.gz: bf28366333ea61538c57e17d981867fc28cd718b16328534dc58f6249bf52c132269014e8cb81e66b47155247705b7cf738c3f56c16df7e4df3cf6ee10e738cd
7
- data.tar.gz: be1c15ab8b01dd86d6d136923da9048c2f0fc66c8cc13be77f01e3f577df22d80e617c97a08551b4b9d4a99f0dc0162292aaa66f93afb0716c2ffe83b8d75c66
6
+ metadata.gz: 992fe072934195cfc3a379a5fc6cdb3c86b7a945052c1dd8cfb572c659f54968c6b7d487def93a7dc018b5fc7c9471d560122e19e982d749e39337a1e00892e0
7
+ data.tar.gz: b16c02adb9e81d4ea93daac76f9741f2e799d7c700608a567a16d2c53e1d4c0a14d689f3275a53bc772e9da11d1d11b0d89b48d505ddf5f9eee30979cd2de652
@@ -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: { available_locales: available_locales, domain: domain, locale: ne_locale }}
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
@@ -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
- return if @initializing || initialized?
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 == 'I18N_STATE' && action.key?(:set_state)
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
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module I18n
3
- VERSION = '22.9.0.rc2'
3
+ VERSION = '22.9.0.rc4'
4
4
  end
5
5
  end
@@ -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::StoreInit')
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'
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.9.0.rc2
4
+ version: 22.9.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-24 00:00:00.000000000 Z
11
+ date: 2022-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,42 +100,42 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.15.1
103
+ version: 0.15.4
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.15.1
110
+ version: 0.15.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: isomorfeus-redux
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 22.9.0.rc2
117
+ version: 22.9.0.rc4
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.rc2
124
+ version: 22.9.0.rc4
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.rc2
131
+ version: 22.9.0.rc4
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.rc2
138
+ version: 22.9.0.rc4
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.rc2
159
+ version: 22.9.0.rc4
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.rc2
166
+ version: 22.9.0.rc4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rake
169
169
  requirement: !ruby/object:Gem::Requirement