translations_ennder 0.9.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  == 0.9.6 / 2011-01-10
11
11
  * Traces et correction appel
12
+
13
+ == 1.0.0 / 2011-01-10
14
+ * Ajout méthode set_locale au helper de l'appli
@@ -9,4 +9,36 @@ module ApplicationHelper
9
9
  label(true, object_name, method, "<b>#{text}</b> :", true, options)
10
10
  end
11
11
  end
12
+
13
+ ########################################################
14
+ # Recherche et M-À-J la locale #
15
+ # depuis les params de requête, la session, la requête #
16
+ # JBA 2010-09-07 #
17
+ ########################################################
18
+ def set_locale
19
+ if (params[:locale] and params[:locale].match /^(en|fr)$/)
20
+ I18n.locale = params[:locale]
21
+ elsif session[:locale].nil?
22
+ if request.env['HTTP_ACCEPT_LANGUAGE'].blank?
23
+ #2011-01-05 Vérif° supplémentaire
24
+ _http_lang = ''
25
+ else
26
+ _http_lang = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
27
+ end
28
+
29
+ if _http_lang.match /^(en|fr)$/
30
+ I18n.locale = _http_lang
31
+ else
32
+ I18n.locale = :fr
33
+ end
34
+ else
35
+ I18n.locale = session[:locale] || :fr
36
+ end
37
+
38
+ # logger.debug "locale=[#{session[:locale]}]"
39
+
40
+ if session[:locale] != I18n.locale
41
+ session[:locale] = I18n.locale
42
+ end
43
+ end
12
44
  end
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.9.6
1
+ 1.0.0
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: 55
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 9
9
- - 6
10
- version: 0.9.6
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ennder