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 CHANGED
@@ -15,3 +15,6 @@
15
15
 
16
16
  == 1.0.1 / 2011-01-10
17
17
  * set_locale : Helper vers extension ApplicationController
18
+
19
+ == 1.0.2 / 2011-01-10
20
+ * set_locale : extension Base:ActionController
@@ -25,26 +25,28 @@ else
25
25
  end
26
26
 
27
27
 
28
- class ApplicationController
29
- # Instance methods here
30
- def set_locale
31
- if (params[:locale] and params[:locale].match /^(en|fr)$/)
32
- I18n.locale = params[:locale]
33
- elsif session[:locale].nil?
34
- _http_lang = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
35
- if _http_lang.match /^(en|fr)$/
36
- I18n.locale = _http_lang
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
- if session[:locale] != I18n.locale
47
- session[:locale] = I18n.locale
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
+ 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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ennder