isomorfeus-i18n 2.0.12 → 2.0.16

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: 613b908acba7262dd04c55944edbc6a7a1fa6894830d68135b081881dd0de42c
4
- data.tar.gz: aebd94835a822df83c9f0aa1577f18a7972cd15d5cebd14e4941d02b1db87cce
3
+ metadata.gz: 39ef3914e3892a639717c15b9a35ea337b30e3a6474e16fd34c47e85646d92fe
4
+ data.tar.gz: ba8d5f05ce7f1f40b5b17c7fa1ad747a80b01a7ab314ed09f6a8341da7a7434b
5
5
  SHA512:
6
- metadata.gz: e33f49c37958b98a9cc7adb87a2e776b8ce2f1f4b1dfaf9636b3bdbbc6a4f1db444ea6d836f43cf6d4a74f8847d09142a34220227bb07ac947a85924298aaa3c
7
- data.tar.gz: 7a466fe08c657c1db9b3afba3f4a3a8851a831d7ff23489c9af7c89a57f2d546d1ccbf94205182edd7a6383403a5bb0448bd6d060f1b27d06a45f387824a1e3e
6
+ metadata.gz: fbf34382edb05ec974898ba308a02b162d4a465fd67c5458da486e3a32e0ae1288feb0c8bf1fe5d636de56bf7c3ac0fcd8c5ceb5c7f25668451f1596940e2f75
7
+ data.tar.gz: f35ed10dd0558b60680fa700ce940c8abc679961c96a45e0b61f4fb77d82d42a0eaee12d2e20fb7084b142a28509a54260f8d05aafb93ffdb27c5014169a8455
@@ -0,0 +1,6 @@
1
+ class FastGettext::Cache
2
+ def reload_all!
3
+ @store = {}
4
+ reload!
5
+ end
6
+ end
@@ -18,12 +18,16 @@ module Isomorfeus
18
18
  'domain' => FastGettext.text_domain }
19
19
  response_agent.agent_result['data']['locale'] = if Isomorfeus.available_locales.include?(locale)
20
20
  locale
21
- else
22
- FastGettext.locale
23
- end
21
+ else
22
+ FastGettext.locale
23
+ end
24
24
  else
25
25
  response_agent.agent_result[domain] = {}
26
26
  begin
27
+ if Isomorfeus.development?
28
+ Isomorfeus::I18n::Init.init
29
+ FastGettext.cache.reload_all!
30
+ end
27
31
  FastGettext.with_domain(domain) do
28
32
  response_agent.request[domain].each_key do |locale|
29
33
  response_agent.agent_result[domain][locale] = {}
@@ -18,13 +18,7 @@ module Isomorfeus
18
18
 
19
19
  def init_from_server
20
20
  Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', :init, Isomorfeus.negotiated_locale).then do |agent|
21
- if agent.processed
22
- agent.result
23
- else
24
- agent.processed = true
25
- if agent.response.key?(:error)
26
- Isomorfeus.raise_error(message: agent.response[:error])
27
- end
21
+ agent.process do
28
22
  @initializing = false
29
23
  Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: agent.response[:data])
30
24
  @initialized = true
@@ -32,6 +26,14 @@ module Isomorfeus
32
26
  end
33
27
  end
34
28
 
29
+ def reload_from_server
30
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', :init, Isomorfeus.negotiated_locale).then do |agent|
31
+ agent.process do
32
+ Isomorfeus.store.dispatch(type: 'I18N_STATE', set_state: agent.response[:data])
33
+ end
34
+ end
35
+ end
36
+
35
37
  def initialized?
36
38
  @initialized
37
39
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module I18n
3
- VERSION = '2.0.12'
3
+ VERSION = '2.0.16'
4
4
  end
5
5
  end
@@ -15,6 +15,7 @@ else
15
15
  require 'active_support'
16
16
  require 'oj'
17
17
  require 'fast_gettext'
18
+ require 'isomorfeus/fast_gettext_cache'
18
19
  require 'http_accept_language/parser'
19
20
  require 'http_accept_language/middleware'
20
21
  require 'isomorfeus-data'
@@ -112,13 +112,7 @@ module LucidTranslation
112
112
  end
113
113
 
114
114
  def _handle_i18n_response(agent, domain)
115
- if agent.processed
116
- agent.result
117
- else
118
- agent.processed = true
119
- if agent.response.key?(:error)
120
- Isomorfeus.raise_error(message: agent.response[:error])
121
- end
115
+ agent.process do
122
116
  if on_browser?
123
117
  Isomorfeus.store.collect_and_defer_dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
124
118
  else
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: 2.0.12
4
+ version: 2.0.16
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-02-01 00:00:00.000000000 Z
11
+ date: 2022-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.14.7
103
+ version: 0.14.8
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.14.7
110
+ version: 0.14.8
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: isomorfeus-preact
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 10.6.23
117
+ version: 10.6.27
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: 10.6.23
124
+ version: 10.6.27
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: isomorfeus-redux
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,42 +142,42 @@ dependencies:
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 2.0.12
145
+ version: 2.0.16
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 2.0.12
152
+ version: 2.0.16
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: isomorfeus-data
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 2.0.12
159
+ version: 2.0.16
160
160
  type: :runtime
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: 2.0.12
166
+ version: 2.0.16
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: isomorfeus
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 2.0.12
173
+ version: 2.0.16
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 2.0.12
180
+ version: 2.0.16
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rake
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -215,6 +215,7 @@ files:
215
215
  - LICENSE
216
216
  - README.md
217
217
  - lib/isomorfeus-i18n.rb
218
+ - lib/isomorfeus/fast_gettext_cache.rb
218
219
  - lib/isomorfeus/i18n/config.rb
219
220
  - lib/isomorfeus/i18n/handler/locale_handler.rb
220
221
  - lib/isomorfeus/i18n/init.rb