isomorfeus-i18n 1.0.0.zeta3 → 1.0.0.zeta4

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: ee759498034f223d763dd0bbb9a5b5f8f9ef49988c8c26f3d553f5ee130d2a07
4
- data.tar.gz: a9b64bbaa53da1a3c8e2fbe49175b4201194c2c5f24298bb091320105deb33c7
3
+ metadata.gz: 5c24b6009a1407ed243bec89d0d3797bdd38827221f5d49cd1cdcc7b47cd0735
4
+ data.tar.gz: '03809625fe880fdf7d4d82dc13406a12048494987d570fc15e5fcfbe91c7edf7'
5
5
  SHA512:
6
- metadata.gz: e3d763b7efa1a0515e6d66441869e02eff90a6e56d336bb56d6138f272969cbb0f708a5f20d23cc2a5ad87fc5687d9d78f082bcef5415e4086ef578a8830934e
7
- data.tar.gz: ad76ccec03b576d03143e09f3faf18abc344baaf3cd0f1ab6f1a5a5fabaa6ab05c3aba13b0c5ecd98d28d6ad1f5324a11e74523413eb50f36d53f204f8306e6e
6
+ metadata.gz: 96210bae92100ce9bb5edff34c5afc034d8168405ebea9dae7637dd73e442f3680004e4c1fafe9feb9b104b6739176bfff5e3848cf5dcf7965e6a1da258b3889
7
+ data.tar.gz: 6d71cd690d73a11647e15441b63796addc5a1fcc3d3394dd58ca228903039fc5783a78f69f0ea1427fe5249a73ba29ffc5729e8afd3449611d32cc05030ad2c3
@@ -9,13 +9,18 @@ module Isomorfeus
9
9
  root_element = `document.querySelector('div[data-iso-root]')`
10
10
  Isomorfeus.negotiated_locale = root_element.JS.getAttribute('data-iso-nloc')
11
11
  end
12
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', :init, Isomorfeus.negotiated_locale).then do |response|
13
- if response[:agent_response].key?(:error)
14
- `console.error(#{response[:agent_response][:error].to_n})`
15
- raise response[:agent_response][:error]
12
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', :init, Isomorfeus.negotiated_locale).then do |agent|
13
+ if agent.processed
14
+ agent.result
15
+ else
16
+ agent.processed = true
17
+ if agent.response.key?(:error)
18
+ `console.error(#{agent.response[:error].to_n})`
19
+ raise agent.response[:error]
20
+ end
21
+ @initializing = false
22
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: agent.response[:data])
16
23
  end
17
- @initializing = false
18
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: response[:agent_response][:data])
19
24
  end
20
25
  end
21
26
 
@@ -14,7 +14,7 @@ module Isomorfeus
14
14
  end
15
15
  when 'I18N_LOAD'
16
16
  result = prev_state.deep_merge(action[:data])
17
- result
17
+ result == prev_state ? prev_state : result
18
18
  else
19
19
  prev_state
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module I18n
3
- VERSION = '1.0.0.zeta3'
3
+ VERSION = '1.0.0.zeta4'
4
4
  end
5
5
  end
@@ -16,15 +16,21 @@ module LucidTranslation
16
16
  def _(*keys, &block)
17
17
  domain = Isomorfeus.i18n_domain
18
18
  locale = Isomorfeus.locale
19
+ raise "I18n _(): no key given!" if keys.empty?
19
20
  result = Redux.fetch_by_path(:i18n_state, domain, locale, '_', keys)
20
21
  return result if result
21
22
  if Isomorfeus::I18n::Init.initialized?
22
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, '_', keys).then do |response|
23
- if response[:agent_response].key?(:error)
24
- `console.error(#{response[:agent_response][:error].to_n})`
25
- raise response[:agent_response][:error]
23
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, '_', keys).then do |agent|
24
+ if agent.processed
25
+ agent.result
26
+ else
27
+ agent.processed = true
28
+ if agent.response.key?(:error)
29
+ `console.error(#{agent.response[:error].to_n})`
30
+ raise agent.response[:error]
31
+ end
32
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
26
33
  end
27
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => response[:agent_response][domain] })
28
34
  end
29
35
  end
30
36
  block_given? ? block.call : keys.first
@@ -33,15 +39,21 @@ module LucidTranslation
33
39
  def n_(*keys, count, &block)
34
40
  domain = Isomorfeus.i18n_domain
35
41
  locale = Isomorfeus.locale
42
+ raise "I18n n_(): no key given!" if keys.empty?
36
43
  result = Redux.fetch_by_path(:i18n_state, domain, locale, 'n_', keys + [count])
37
44
  return result if result
38
45
  if Isomorfeus::I18n::Init.initialized?
39
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 'n_', keys + [count]).then do |response|
40
- if response[:agent_response].key?(:error)
41
- `console.error(#{response[:agent_response][:error].to_n})`
42
- raise response[:agent_response][:error]
46
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 'n_', keys + [count]).then do |agent|
47
+ if agent.processed
48
+ agent.result
49
+ else
50
+ agent.processed = true
51
+ if agent.response.key?(:error)
52
+ `console.error(#{agent.response[:error].to_n})`
53
+ raise agent.response[:error]
54
+ end
55
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
43
56
  end
44
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => response[:agent_response][domain] })
45
57
  end
46
58
  end
47
59
  block_given? ? block.call : keys.last
@@ -58,15 +70,21 @@ module LucidTranslation
58
70
  def ns_(*args, &block)
59
71
  domain = Isomorfeus.i18n_domain
60
72
  locale = Isomorfeus.locale
73
+ raise "I18n ns_(): no args given!" if args.empty?
61
74
  result = Redux.fetch_by_path(:i18n_state, domain, locale, 'ns_', args)
62
75
  return result if result
63
76
  if Isomorfeus::I18n::Init.initialized?
64
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 'ns_', args).then do |response|
65
- if response[:agent_response].key?(:error)
66
- `console.error(#{response[:agent_response][:error].to_n})`
67
- raise response[:agent_response][:error]
77
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 'ns_', args).then do |agent|
78
+ if agent.processed
79
+ agent.result
80
+ else
81
+ agent.processed = true
82
+ if agent.response.key?(:error)
83
+ `console.error(#{agent.response[:error].to_n})`
84
+ raise agent.response[:error]
85
+ end
86
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
68
87
  end
69
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => response[:agent_response][domain] })
70
88
  end
71
89
  end
72
90
  block_given? ? block.call : n_(*args).split(NAMESPACE_SEPARATOR).last
@@ -79,12 +97,17 @@ module LucidTranslation
79
97
  result = Redux.fetch_by_path(:i18n_state, domain, locale, 'p_', args)
80
98
  return result if result
81
99
  if Isomorfeus::I18n::Init.initialized?
82
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 'p_', args).then do |response|
83
- if response[:agent_response].key?(:error)
84
- `console.error(#{response[:agent_response][:error].to_n})`
85
- raise response[:agent_response][:error]
100
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 'p_', args).then do |agent|
101
+ if agent.processed
102
+ agent.result
103
+ else
104
+ agent.processed = true
105
+ if agent.response.key?(:error)
106
+ `console.error(#{agent.response[:error].to_n})`
107
+ raise agent.response[:error]
108
+ end
109
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
86
110
  end
87
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => response[:agent_response][domain] })
88
111
  end
89
112
  end
90
113
  block_given? ? block.call : key
@@ -97,12 +120,17 @@ module LucidTranslation
97
120
  result = Redux.fetch_by_path(:i18n_state, domain, locale, 's_', args)
98
121
  return result if result
99
122
  if Isomorfeus::I18n::Init.initialized?
100
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 's_', args).then do |response|
101
- if response[:agent_response].key?(:error)
102
- `console.error(#{response[:agent_response][:error].to_n})`
103
- raise response[:agent_response][:error]
123
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, 's_', args).then do |agent|
124
+ if agent.processed
125
+ agent.result
126
+ else
127
+ agent.processed = true
128
+ if agent.response.key?(:error)
129
+ `console.error(#{agent.response[:error].to_n})`
130
+ raise agent.response[:error]
131
+ end
132
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
104
133
  end
105
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => response[:agent_response][domain] })
106
134
  end
107
135
  end
108
136
  block_given? ? block.call : key.split(separator || NAMESPACE_SEPARATOR).last
@@ -130,15 +158,21 @@ module LucidTranslation
130
158
  define_method("D#{method}") do |*args, &block|
131
159
  domain = Isomorfeus.i18n_domain
132
160
  locale = Isomorfeus.locale
161
+ raise "I18n D#{method}(): no args given!" if args.empty?
133
162
  result = Redux.fetch_by_path(:i18n_state, domain, locale, "D#{method}", args)
134
163
  return result if result
135
164
  if Isomorfeus::I18n::Init.initialized?
136
- Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, "D#{method}", args).then do |response|
137
- if response[:agent_response].key?(:error)
138
- `console.error(#{response[:agent_response][:error].to_n})`
139
- raise response[:agent_response][:error]
165
+ Isomorfeus::Transport.promise_send_path('Isomorfeus::I18n::Handler::LocaleHandler', domain, locale, "D#{method}", args).then do |agent|
166
+ if agent.processed
167
+ agent.result
168
+ else
169
+ agent.processed = true
170
+ if agent.response.key?(:error)
171
+ `console.error(#{agent.response[:error].to_n})`
172
+ raise agent.response[:error]
173
+ end
174
+ Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => agent.response[domain] })
140
175
  end
141
- Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain => response[:agent_response][domain] })
142
176
  end
143
177
  end
144
178
  block_given? ? block.call : send(method, *args, &block)
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: 1.0.0.zeta3
4
+ version: 1.0.0.zeta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 16.9.17
117
+ version: 16.9.20
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: 16.9.17
124
+ version: 16.9.20
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: 1.0.0.zeta3
145
+ version: 1.0.0.zeta4
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: 1.0.0.zeta3
152
+ version: 1.0.0.zeta4
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: 1.0.0.zeta3
159
+ version: 1.0.0.zeta4
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: 1.0.0.zeta3
166
+ version: 1.0.0.zeta4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: isomorfeus-installer
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 1.0.0.zeta3
173
+ version: 1.0.0.zeta4
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: 1.0.0.zeta3
180
+ version: 1.0.0.zeta4
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: opal-webpack-loader
183
183
  requirement: !ruby/object:Gem::Requirement