flame-r18n 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flame/r18n.rb +9 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 883953fcd9390e5fbf7a482c6de232d4109fe371
|
4
|
+
data.tar.gz: 2c3de34304b2bba1b5d253247dcfe729a97b3b4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20193b690de320d2aec0e1743fce71c1ec736796ee88f7f822189ed0775fa3adec1de954c8c7904087601295bbc3c81696f5c94c3d5bd3ec8ccde1c65f5106fe
|
7
|
+
data.tar.gz: 44798d07232f99b28da44eebc5b70a37ab18c9615c401784f1e446d0102d8cfa4da679030a94b3fa8314eb207c6bd30c8ccd436568980facade3d9402f0509af
|
data/lib/flame/r18n.rb
CHANGED
@@ -17,6 +17,7 @@ module Flame
|
|
17
17
|
|
18
18
|
def execute(method)
|
19
19
|
load_r18n
|
20
|
+
session[:locale] = preferred_locale || ::R18n.get.locale.code
|
20
21
|
super
|
21
22
|
end
|
22
23
|
|
@@ -33,18 +34,20 @@ module Flame
|
|
33
34
|
|
34
35
|
def locales_from_env
|
35
36
|
locales = ::R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE'])
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
locales = [preferred_locale] | locales if preferred_locale
|
38
|
+
locales
|
39
|
+
end
|
40
|
+
|
41
|
+
def preferred_locale
|
42
|
+
params[:locale] || session[:locale]
|
41
43
|
end
|
42
44
|
|
43
45
|
def load_r18n
|
44
46
|
::R18n.clear_cache! if config[:environment] == 'development'
|
45
47
|
|
46
48
|
::R18n.thread_set do
|
47
|
-
|
49
|
+
default_locale = config[:default_locale]
|
50
|
+
::R18n::I18n.default = default_locale if default_locale
|
48
51
|
|
49
52
|
init_r18n
|
50
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flame-r18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flame
|
@@ -53,7 +53,7 @@ extensions: []
|
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
55
55
|
- lib/flame/r18n.rb
|
56
|
-
homepage: https://
|
56
|
+
homepage: https://github.com/AlexWayfer/flame-r18n
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
59
|
metadata: {}
|