isomorfeus-i18n 23.9.0.rc7 → 23.9.0.rc9

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: a7ded9ba5ad152e4efd40b727fea61e261354a5a3c5e82c382b604a14306cfd7
4
- data.tar.gz: d767462c93a257efd8f39df1f8451dbea15127f937fad37856ed02d0187f17b2
3
+ metadata.gz: 5d5374fdce9bec3b5feb343a8d3d28e75350009a94058126d6274c6276423a63
4
+ data.tar.gz: 36174b3a97eb759d59854722c6c4673bcc6afc6e3e2f0bd4fb2205d37cbc8538
5
5
  SHA512:
6
- metadata.gz: 4b8c0b0cae704ae3fe78ce94ae5b936286e9a098d8eb8a8bb9908c44372d64ba55ef3c7ac377dac2264863fdc2a5e3457dfcb9f9effe042ba855519aa6a94750
7
- data.tar.gz: 6defecb3116ce8522fd5127d7ef04f6925fe331417793693ca7e0cab64795abc7448545c85039f3a6abd9ddd15b8a79b2e9f26a7e03169c84565a0e3a133c783
6
+ metadata.gz: 9f206933d7fc0bce42eca25692716b77d081d18ce1fe27a9cda6d5160aab5ee7760c6046e11a12adccdcfa75e112305a051e4c66663d36491569c0897c583afe
7
+ data.tar.gz: c281b576b94299198d2455fa2818701290098cf5e382a83dc681692396b819d79477aac40c4d8267b0ca21e9b789e2006b0568aef87aaf8ec974662bab636bcb
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Isomorfeus
4
+ module I18n
5
+ class RackMiddleware
6
+ def initialize(app)
7
+ @app = app
8
+ end
9
+
10
+ def call(env)
11
+ parser = ::HttpAcceptLanguage::Parser.new(env['HTTP_ACCEPT_LANGUAGE'])
12
+ locale = parser.preferred_language_from(::Isomorfeus.available_locales) ||
13
+ parser.compatible_language_from(::Isomorfeus.available_locales) ||
14
+ ::Isomorfeus.default_locale
15
+ ::Isomorfeus.current_locale = locale if ::Isomorfeus.current_locale != locale
16
+ env['http_accept_language.parser'] = parser
17
+ env['locale'] = locale
18
+ @app.call(env)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module I18n
3
- VERSION = '23.9.0.rc7'
3
+ VERSION = '23.9.0.rc9'
4
4
  end
5
5
  end
@@ -24,11 +24,9 @@ Isomorfeus::I18n::Enhancer.add_enhancer_to_store
24
24
 
25
25
  if RUBY_ENGINE != 'opal'
26
26
  require 'http_accept_language/parser'
27
- require 'http_accept_language/middleware'
28
- require 'isomorfeus/i18n/middleware'
27
+ require 'isomorfeus/i18n/rack_middleware'
29
28
 
30
- Isomorfeus.add_middleware(HttpAcceptLanguage::Middleware)
31
- Isomorfeus.insert_middleware_after(HttpAcceptLanguage::Middleware, Isomorfeus::I18n::Middleware)
29
+ Isomorfeus.insert_middleware_before(Isomorfeus::Transport::RackMiddleware, Isomorfeus::I18n::RackMiddleware)
32
30
 
33
31
  require 'iso_opal'
34
32
  Opal.append_path(__dir__) unless IsoOpal.paths.include?(__dir__)
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: 23.9.0.rc7
4
+ version: 23.9.0.rc9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-18 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -106,28 +106,28 @@ dependencies:
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 23.9.0.rc7
109
+ version: 23.9.0.rc9
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 23.9.0.rc7
116
+ version: 23.9.0.rc9
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: isomorfeus-transport
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 23.9.0.rc7
123
+ version: 23.9.0.rc9
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 23.9.0.rc7
130
+ version: 23.9.0.rc9
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: r18n-core
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -148,14 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - '='
150
150
  - !ruby/object:Gem::Version
151
- version: 23.9.0.rc7
151
+ version: 23.9.0.rc9
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - '='
157
157
  - !ruby/object:Gem::Version
158
- version: 23.9.0.rc7
158
+ version: 23.9.0.rc9
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: rake
161
161
  requirement: !ruby/object:Gem::Requirement
@@ -198,8 +198,8 @@ files:
198
198
  - lib/isomorfeus/i18n/fast_gettext/cache.rb
199
199
  - lib/isomorfeus/i18n/fast_gettext/translation_repository/base.rb
200
200
  - lib/isomorfeus/i18n/init.rb
201
- - lib/isomorfeus/i18n/middleware.rb
202
201
  - lib/isomorfeus/i18n/missing_keys.rb
202
+ - lib/isomorfeus/i18n/rack_middleware.rb
203
203
  - lib/isomorfeus/i18n/reducer.rb
204
204
  - lib/isomorfeus/i18n/version.rb
205
205
  - lib/lucid_i18n_mixin.rb
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Isomorfeus
4
- module I18n
5
- class Middleware
6
- def initialize(app)
7
- @app = app
8
- end
9
-
10
- def call(env)
11
- locale = env.http_accept_language.preferred_language_from(Isomorfeus.available_locales) ||
12
- env.http_accept_language.compatible_language_from(Isomorfeus.available_locales) ||
13
- Isomorfeus.default_locale
14
- Isomorfeus.current_locale = locale if Isomorfeus.current_locale != locale
15
- @app.call(env)
16
- end
17
- end
18
- end
19
- end