i18n_strategy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -1
- data/lib/i18n_strategy/initializer.rb +1 -2
- data/lib/i18n_strategy/version.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +16 -29
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e0610e8edc1c6552d8556bf0b54885ec77e8606c
|
4
|
+
data.tar.gz: c03f6f08627db8d606ebf08f823f00b8d30fedb8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e76b93fe160582906aa17b487ecf6bd72b4d8b3a17c72568dabcd9e6a6d1ab5f3693f3080cce3130d209f96337cfd3c3a29eaad7c68fec07e5afc7ddebf65ce
|
7
|
+
data.tar.gz: 66cc05e927d31f48a1856c63c9d9a3fe489c42abccefba2143379bfd429481f0caa90d039a47ab373e669ec6939edc0de062ea1a3eadffb39d40fb254625dfe0
|
data/README.md
CHANGED
@@ -12,7 +12,9 @@ gem 'i18n_strategy'
|
|
12
12
|
```
|
13
13
|
|
14
14
|
Then, set your custom strategy into `I18nStrategy.strategy`, which is
|
15
|
-
to detect a locale for a user visiting your application
|
15
|
+
to detect a locale for a user visiting your application, and also set
|
16
|
+
available languages in your application via
|
17
|
+
`I18nStrategy.available_languages`.
|
16
18
|
|
17
19
|
`initializers/i18n_strategy`:
|
18
20
|
|
@@ -3,7 +3,6 @@ module I18nStrategy
|
|
3
3
|
|
4
4
|
class Initializer
|
5
5
|
def self.init(app)
|
6
|
-
# Set I18nStrategy::Strategy::Default as default strategy
|
7
6
|
I18nStrategy.strategy ||= I18nStrategy::Strategy::Default
|
8
7
|
|
9
8
|
ActiveSupport.on_load(:action_controller) do
|
@@ -20,7 +19,7 @@ module I18nStrategy
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def set_locale
|
23
|
-
|
22
|
+
extend(I18nStrategy.strategy)
|
24
23
|
I18n.locale = send(I18nStrategy.method_to_detect_locale || :detect_locale)
|
25
24
|
end
|
26
25
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_strategy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kentaro Kuribayashi
|
@@ -14,81 +13,71 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: http_accept_language
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.0.0pre
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.0.0pre
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec-rails
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
description: Provides a very much simple way to detect and set locale in your Rails
|
@@ -117,30 +106,28 @@ files:
|
|
117
106
|
- spec/spec_helper.rb
|
118
107
|
homepage: https://github.com/kentaro/i18n_strategy
|
119
108
|
licenses: []
|
109
|
+
metadata: {}
|
120
110
|
post_install_message:
|
121
111
|
rdoc_options: []
|
122
112
|
require_paths:
|
123
113
|
- lib
|
124
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
115
|
requirements:
|
127
|
-
- -
|
116
|
+
- - '>='
|
128
117
|
- !ruby/object:Gem::Version
|
129
118
|
version: '0'
|
130
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
120
|
requirements:
|
133
|
-
- -
|
121
|
+
- - '>='
|
134
122
|
- !ruby/object:Gem::Version
|
135
123
|
version: '0'
|
136
124
|
requirements: []
|
137
125
|
rubyforge_project:
|
138
|
-
rubygems_version:
|
126
|
+
rubygems_version: 2.0.2
|
139
127
|
signing_key:
|
140
|
-
specification_version:
|
128
|
+
specification_version: 4
|
141
129
|
summary: Provides a very much simple way to detect and set locale in your Rails application
|
142
130
|
test_files:
|
143
131
|
- spec/app/test_app.rb
|
144
132
|
- spec/controllers/locale_spec.rb
|
145
133
|
- spec/spec_helper.rb
|
146
|
-
has_rdoc:
|