translations_ennder 1.1.8 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +3 -0
- data/lib/translations_ennder/rails.rb +9 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2e282df726895551070c32ff0254f75f0e7a576
|
4
|
+
data.tar.gz: add637fe99089bf84f6f43fc2dd88f194931cf78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a19bd0524c6b2d0e5f3ef02c2adab56399a04ac52820d9420afbc76a5126ba88bf0060cc789e28f42f105177d41b3c62515a04aa77900d3398d919109154e02
|
7
|
+
data.tar.gz: a0b60ab01a0a6b73987bef07342e83d436c736f3de8dc1bf67ae8121e21f2a9e4a138b72a7a4f3b3006354b55aff370a3cd08fa83373901a2928c9608a3856ad
|
data/Changelog
CHANGED
@@ -49,23 +49,19 @@ end
|
|
49
49
|
|
50
50
|
module ActionController
|
51
51
|
class Base
|
52
|
-
# Instance methods here
|
53
|
-
|
54
52
|
def set_locale
|
55
|
-
#
|
56
|
-
if session[:session_id].blank?
|
57
|
-
return
|
58
|
-
end
|
53
|
+
# Needs a session
|
54
|
+
return if session[:session_id].blank?
|
59
55
|
|
60
56
|
_param_locale = params[:locale]
|
61
|
-
if
|
62
|
-
#
|
57
|
+
if _param_locale.present? && _param_locale.match(/^(en|fr)$/)
|
58
|
+
# Comes from a request parameter
|
63
59
|
I18n.locale = _param_locale
|
64
|
-
elsif session[:locale].blank?
|
65
|
-
#
|
60
|
+
elsif session[:locale].blank? && request.env['HTTP_ACCEPT_LANGUAGE'].present?
|
61
|
+
# Comes from the request headers
|
66
62
|
_http_lang_tab = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/)
|
67
|
-
if
|
68
|
-
if _http_lang_tab.first.match
|
63
|
+
if _http_lang_tab.present? && _http_lang_tab.first.present?
|
64
|
+
if _http_lang_tab.first.match(/^(en|fr)$/)
|
69
65
|
I18n.locale = _http_lang_tab.first
|
70
66
|
else
|
71
67
|
set_locale_session_or_fr
|
@@ -86,9 +82,8 @@ module ActionController
|
|
86
82
|
end
|
87
83
|
|
88
84
|
def set_locale_session_or_fr
|
89
|
-
#
|
85
|
+
# Comes from the session or not provided
|
90
86
|
I18n.locale = session[:locale] || :fr
|
91
87
|
end
|
92
88
|
end
|
93
89
|
end
|
94
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translations_ennder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ennder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Apporte des traductions Françaises et Anglaises. Permet la traduction
|
14
14
|
automatique des labels pour Rails 2 et Rails 3+
|