dekiru 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/dekiru.gemspec +1 -0
- data/lib/dekiru.rb +1 -0
- data/lib/dekiru/controller_additions.rb +19 -0
- data/lib/dekiru/railtie.rb +4 -0
- data/lib/dekiru/version.rb +1 -1
- metadata +25 -2
data/dekiru.gemspec
CHANGED
data/lib/dekiru.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "http_accept_language"
|
2
|
+
|
3
|
+
module Dekiru
|
4
|
+
module ControllerAdditions
|
5
|
+
def set_locale
|
6
|
+
I18n.locale = locale_from_params || locale_from_header
|
7
|
+
logger.info "[locale] #{I18n.locale}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def locale_from_params
|
11
|
+
(I18n.available_locales & [params[:locale].try(:to_sym)]).first
|
12
|
+
end
|
13
|
+
|
14
|
+
def locale_from_header
|
15
|
+
logger.debug "[debug] #{http_accept_language.user_preferred_languages}"
|
16
|
+
http_accept_language.compatible_language_from(I18n.available_locales)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/dekiru/railtie.rb
CHANGED
data/lib/dekiru/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dekiru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: http_accept_language
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.0.pre
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.0.pre
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: rake
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,6 +57,7 @@ files:
|
|
41
57
|
- Rakefile
|
42
58
|
- dekiru.gemspec
|
43
59
|
- lib/dekiru.rb
|
60
|
+
- lib/dekiru/controller_additions.rb
|
44
61
|
- lib/dekiru/helper.rb
|
45
62
|
- lib/dekiru/railtie.rb
|
46
63
|
- lib/dekiru/version.rb
|
@@ -56,12 +73,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
73
|
- - ! '>='
|
57
74
|
- !ruby/object:Gem::Version
|
58
75
|
version: '0'
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
hash: -2706103104152094654
|
59
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
80
|
none: false
|
61
81
|
requirements:
|
62
82
|
- - ! '>='
|
63
83
|
- !ruby/object:Gem::Version
|
64
84
|
version: '0'
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
hash: -2706103104152094654
|
65
88
|
requirements: []
|
66
89
|
rubyforge_project:
|
67
90
|
rubygems_version: 1.8.23
|