translations_ennder 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/lib/translations_ennder/rails.rb +22 -9
- data/version.txt +1 -1
- metadata +7 -9
- data/.gitignore +0 -8
data/History.txt
CHANGED
@@ -28,26 +28,39 @@ end
|
|
28
28
|
module ActionController
|
29
29
|
class Base
|
30
30
|
# Instance methods here
|
31
|
+
|
31
32
|
def set_locale
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
_param_locale = params[:locale]
|
34
|
+
if (!_param_locale.blank?) and _param_locale.match /^(en|fr)$/)
|
35
|
+
#Vient du paramètre de requête
|
36
|
+
I18n.locale = _param_locale
|
37
|
+
elsif session[:locale].blank? and (! request.env['HTTP_ACCEPT_LANGUAGE'].blank?)
|
38
|
+
#Vient des entêtes de la requête
|
39
|
+
_http_lang_tab = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/)
|
40
|
+
if (! _http_lang_tab.empty?) and (! _http_lang.first.blank? )
|
41
|
+
if _http_lang.first.match /^(en|fr)$/
|
42
|
+
I18n.locale = _http_lang.first
|
43
|
+
else
|
44
|
+
set_locale_session_or_fr
|
45
|
+
end
|
38
46
|
else
|
39
|
-
|
47
|
+
set_locale_session_or_fr
|
40
48
|
end
|
41
49
|
else
|
42
|
-
|
50
|
+
set_locale_session_or_fr
|
43
51
|
end
|
44
52
|
|
45
|
-
|
53
|
+
# logger.debug "locale=[#{session[:locale]}]"
|
46
54
|
|
47
55
|
if session[:locale] != I18n.locale
|
48
56
|
session[:locale] = I18n.locale
|
49
57
|
end
|
50
58
|
end
|
59
|
+
|
60
|
+
def set_locale_session_or_fr
|
61
|
+
#Vient de la session, ou pas fourni
|
62
|
+
I18n.locale = session[:locale] || :fr
|
63
|
+
end
|
51
64
|
end
|
52
65
|
end
|
53
66
|
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
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: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ennder
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-21 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 21
|
30
30
|
segments:
|
31
31
|
- 3
|
32
|
+
- 6
|
32
33
|
- 5
|
33
|
-
|
34
|
-
version: 3.5.4
|
34
|
+
version: 3.6.5
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id001
|
37
37
|
description: "Ce plugin apporte des traductions standard en fran\xC3\xA7ais et anglais.\n\
|
@@ -50,10 +50,8 @@ extra_rdoc_files:
|
|
50
50
|
- lib/translations_ennder/locales/.directory
|
51
51
|
- lib/translations_ennder/locales/en.yml
|
52
52
|
- lib/translations_ennder/locales/fr.yml
|
53
|
-
- version.txt
|
54
53
|
files:
|
55
54
|
- .bnsignore
|
56
|
-
- .gitignore
|
57
55
|
- History.txt
|
58
56
|
- README.md
|
59
57
|
- Rakefile
|