rack-locale_memorable 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +14 -15
- data/lib/rack/locale_memorable/version.rb +1 -1
- data/rack-locale_memorable.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee932ccf31e17732f87bcbf4db7647cae4836b1424d85097da281ffe1ffaeddf
|
|
4
|
+
data.tar.gz: 9c807857bf6296170af7746df724aa24d90ff9f7fb22d4c41b508f365da51cda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ba6eff0fbb1cd813a1ad908cea006779858702d63911592679893060b10ba0c464cef63d7a493ef366aaedac558fa85f492cbd9f6653b06de8e5baebac7ae97
|
|
7
|
+
data.tar.gz: ac2e798b0ac97a176af482b78f260eae3ece611c197f2435196895c869127d7cf2beb0c25d0798e5858003d369be131e7d2a097cbe8d11790a133755cb2082c6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -21,29 +21,20 @@ Rails.application.configure do |config|
|
|
|
21
21
|
end
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```ruby
|
|
27
|
-
Rails.application.configure do |config|
|
|
28
|
-
config.middleware.insert_before Warden::Manager, Rack::LocaleMemorable
|
|
29
|
-
end
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
By default, this gem handles
|
|
24
|
+
By default, this gem handles locale variables in 3 places in the order below, and when explicit locale is specified (= when locale is specified via query params) in the request, remember it in cookie too.
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
1. `params['locale']` as explicit locale
|
|
27
|
+
2. `cookies['locale']` as remembered locale
|
|
28
|
+
3. `headers['HTTP_ACCEPT_LANGUAGE']` as implicit locale
|
|
37
29
|
|
|
38
|
-
|
|
30
|
+
There are several customizable options listed below.
|
|
39
31
|
|
|
40
|
-
You can customize those values
|
|
41
32
|
* params_key (`'locale'` by default)
|
|
42
33
|
* cookie_key (`'locale'` by default)
|
|
43
34
|
* secure_cookie (`true` by default)
|
|
44
35
|
* cookie_lifetime (`1.year` by default)
|
|
45
36
|
|
|
46
|
-
like below
|
|
37
|
+
You can customize them like below
|
|
47
38
|
|
|
48
39
|
```ruby
|
|
49
40
|
Rails.application.configure do |config|
|
|
@@ -57,6 +48,14 @@ Rails.application.configure do |config|
|
|
|
57
48
|
end
|
|
58
49
|
```
|
|
59
50
|
|
|
51
|
+
NOTE: If you're using devise, set `Rack::LocaleMemorable` before `Warden::Manager`, otherwise you see warden error messages in wrong locale.
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
Rails.application.configure do |config|
|
|
55
|
+
config.middleware.insert_before Warden::Manager, Rack::LocaleMemorable
|
|
56
|
+
end
|
|
57
|
+
```
|
|
58
|
+
|
|
60
59
|
## Development
|
|
61
60
|
|
|
62
61
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
18
|
spec.metadata['source_code_uri'] = 'https://github.com/nov/rack-locale_memorable'
|
|
19
|
-
spec.metadata['changelog_uri'] = 'https://github.com/nov/rack-locale_memorable/CHANGELOG.md'
|
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/nov/rack-locale_memorable/blob/main/CHANGELOG.md'
|
|
20
20
|
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-locale_memorable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-09-
|
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|
|
@@ -147,7 +147,7 @@ licenses:
|
|
|
147
147
|
metadata:
|
|
148
148
|
homepage_uri: https://github.com/nov/rack-locale_memorable
|
|
149
149
|
source_code_uri: https://github.com/nov/rack-locale_memorable
|
|
150
|
-
changelog_uri: https://github.com/nov/rack-locale_memorable/CHANGELOG.md
|
|
150
|
+
changelog_uri: https://github.com/nov/rack-locale_memorable/blob/main/CHANGELOG.md
|
|
151
151
|
post_install_message:
|
|
152
152
|
rdoc_options: []
|
|
153
153
|
require_paths:
|