isomorfeus-i18n 23.9.0.rc8 → 23.9.0.rc9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/i18n/rack_middleware.rb +22 -0
- data/lib/isomorfeus/i18n/version.rb +1 -1
- data/lib/isomorfeus-i18n.rb +2 -4
- metadata +9 -9
- data/lib/isomorfeus/i18n/middleware.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d5374fdce9bec3b5feb343a8d3d28e75350009a94058126d6274c6276423a63
|
4
|
+
data.tar.gz: 36174b3a97eb759d59854722c6c4673bcc6afc6e3e2f0bd4fb2205d37cbc8538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/isomorfeus-i18n.rb
CHANGED
@@ -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 '
|
28
|
-
require 'isomorfeus/i18n/middleware'
|
27
|
+
require 'isomorfeus/i18n/rack_middleware'
|
29
28
|
|
30
|
-
Isomorfeus.
|
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.
|
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-
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|