isomorfeus-i18n 23.9.0.rc8 → 23.9.0.rc10

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: '08876874de4e859edf0835127998a8f7411230275dea49f9fc9c9bfea04dd1e1'
4
- data.tar.gz: 3c478e87f5ae5e389f9874d4efed626a62a0a97941e77b4354f8c38f945bf422
3
+ metadata.gz: a0440d08908cb73a829a880f6ed923d62c029af89f2d49f7c4baf4db30d90ba0
4
+ data.tar.gz: 409b17ce36ee9086c9a1ca137ec3ee654b4cc55cfc22f816f5210256387d0c97
5
5
  SHA512:
6
- metadata.gz: e874f672ee0f564d720b1379020fc370ed94d5a8dc390d3d72e8504ef25823d0081acbe357c10b8b4884d603e6dd017754464d10022b181eab034c6b05cae019
7
- data.tar.gz: b00e5def377d401437bf70538285138246aabaf2d045a1536b1287db3c6e3c45751331cc2fd4ca5489223a039ccdfe3be91259c0bdf471d90df12ef76898e264
6
+ metadata.gz: b663752ae3508cba655df3b544417faa6414953c6f1130e7939df937640a49055ab987bf0c719dd599288418684cf9e41668c260f66e7aaf226ac7ccbbfe3a69
7
+ data.tar.gz: 8a0fc084c7b287d690b512dd042947259fe91a666cdc609e713f7eac30082e66d27630a9cb713376f9cfdafdea8f1539a722a50960c02c354dcb7812279e4faa
@@ -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.rc8'
3
+ VERSION = '23.9.0.rc10'
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.rc8
4
+ version: 23.9.0.rc10
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-20 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.rc8
109
+ version: 23.9.0.rc10
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.rc8
116
+ version: 23.9.0.rc10
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.rc8
123
+ version: 23.9.0.rc10
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.rc8
130
+ version: 23.9.0.rc10
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.rc8
151
+ version: 23.9.0.rc10
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.rc8
158
+ version: 23.9.0.rc10
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