translations_ennder 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/lib/translations_ennder/rails.rb +18 -16
- data/version.txt +1 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -25,26 +25,28 @@ else
|
|
25
25
|
end
|
26
26
|
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
module ActionController
|
29
|
+
class Base
|
30
|
+
# Instance methods here
|
31
|
+
def set_locale
|
32
|
+
if (params[:locale] and params[:locale].match /^(en|fr)$/)
|
33
|
+
I18n.locale = params[:locale]
|
34
|
+
elsif session[:locale].nil?
|
35
|
+
_http_lang = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
|
36
|
+
if _http_lang.match /^(en|fr)$/
|
37
|
+
I18n.locale = _http_lang
|
38
|
+
else
|
39
|
+
I18n.locale = :fr
|
40
|
+
end
|
37
41
|
else
|
38
|
-
I18n.locale = :fr
|
42
|
+
I18n.locale = session[:locale] || :fr
|
39
43
|
end
|
40
|
-
else
|
41
|
-
I18n.locale = session[:locale] || :fr
|
42
|
-
end
|
43
44
|
|
44
|
-
# logger.debug "locale=[#{session[:locale]}]"
|
45
|
+
# logger.debug "locale=[#{session[:locale]}]"
|
45
46
|
|
46
|
-
|
47
|
-
|
47
|
+
if session[:locale] != I18n.locale
|
48
|
+
session[:locale] = I18n.locale
|
49
|
+
end
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translations_ennder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ennder
|