r18n-rails 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/spec/app/app/controllers/test_controller.rb +3 -2
- data/spec/rails_spec.rb +18 -5
- metadata +40 -40
@@ -1,6 +1,8 @@
|
|
1
1
|
class TestController < ApplicationController
|
2
2
|
layout false
|
3
3
|
|
4
|
+
before_filter :reload_r18n, :only => :filter
|
5
|
+
|
4
6
|
def locales
|
5
7
|
render :text => R18n.get.locales.map { |i| i.code }.join(', ')
|
6
8
|
end
|
@@ -24,8 +26,7 @@ class TestController < ApplicationController
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def controller
|
27
|
-
render :text => "#{t
|
28
|
-
"#{r18n.t.user.name}"
|
29
|
+
render :text => "#{t.user.name} #{r18n.t.user.name} #{t('user.name')}"
|
29
30
|
end
|
30
31
|
|
31
32
|
def time
|
data/spec/rails_spec.rb
CHANGED
@@ -4,10 +4,6 @@ require File.expand_path('../spec_helper', __FILE__)
|
|
4
4
|
describe TestController, :type => :controller do
|
5
5
|
render_views
|
6
6
|
|
7
|
-
before do
|
8
|
-
ActionController::Base.send(:before_filter, :reload_r18n)
|
9
|
-
end
|
10
|
-
|
11
7
|
it 'should use default locale' do
|
12
8
|
get :locales
|
13
9
|
response.should be_success
|
@@ -60,7 +56,7 @@ describe TestController, :type => :controller do
|
|
60
56
|
it "should add methods to controller" do
|
61
57
|
get :controller, :locale => 'en'
|
62
58
|
response.should be_success
|
63
|
-
response.body.should == "
|
59
|
+
response.body.should == "Name Name Name"
|
64
60
|
end
|
65
61
|
|
66
62
|
it "should localize time by Rails I18n" do
|
@@ -140,4 +136,21 @@ describe TestController, :type => :controller do
|
|
140
136
|
response.body.should == "1 000.1 руб.\n"
|
141
137
|
end
|
142
138
|
|
139
|
+
it "should cache I18n object" do
|
140
|
+
R18n.clear_cache!
|
141
|
+
|
142
|
+
get :translations
|
143
|
+
R18n.cache.keys.length.should == 1
|
144
|
+
|
145
|
+
get :translations
|
146
|
+
R18n.cache.keys.length.should == 1
|
147
|
+
|
148
|
+
get :translations
|
149
|
+
request.env['HTTP_ACCEPT_LANGUAGE'] = 'ru,fr;q=0.9'
|
150
|
+
R18n.cache.keys.length.should == 1
|
151
|
+
|
152
|
+
get :translations, :locale => 'en'
|
153
|
+
R18n.cache.keys.length.should == 2
|
154
|
+
end
|
155
|
+
|
143
156
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,60 +9,58 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: r18n-rails-api
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.1.
|
19
|
+
version: 1.1.3
|
20
|
+
none: false
|
22
21
|
type: :runtime
|
23
|
-
|
22
|
+
name: r18n-rails-api
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - '='
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.1.
|
27
|
+
version: 1.1.3
|
28
|
+
none: false
|
29
|
+
prerelease: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name: bundler
|
32
31
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
32
|
requirements:
|
35
33
|
- - ! '>='
|
36
34
|
- !ruby/object:Gem::Version
|
37
35
|
version: 1.0.10
|
36
|
+
none: false
|
38
37
|
type: :development
|
39
|
-
|
38
|
+
name: bundler
|
40
39
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
40
|
requirements:
|
43
41
|
- - ! '>='
|
44
42
|
- !ruby/object:Gem::Version
|
45
43
|
version: 1.0.10
|
44
|
+
none: false
|
45
|
+
prerelease: false
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name: yard
|
48
47
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
48
|
requirements:
|
51
49
|
- - ! '>='
|
52
50
|
- !ruby/object:Gem::Version
|
53
51
|
version: '0'
|
52
|
+
none: false
|
54
53
|
type: :development
|
55
|
-
|
54
|
+
name: yard
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
56
|
requirements:
|
59
57
|
- - ! '>='
|
60
58
|
- !ruby/object:Gem::Version
|
61
59
|
version: '0'
|
60
|
+
none: false
|
61
|
+
prerelease: false
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: rake
|
64
63
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
64
|
requirements:
|
67
65
|
- - ! '>='
|
68
66
|
- !ruby/object:Gem::Version
|
@@ -70,10 +68,10 @@ dependencies:
|
|
70
68
|
- - ! '!='
|
71
69
|
- !ruby/object:Gem::Version
|
72
70
|
version: 0.9.0
|
71
|
+
none: false
|
73
72
|
type: :development
|
74
|
-
|
73
|
+
name: rake
|
75
74
|
version_requirements: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
75
|
requirements:
|
78
76
|
- - ! '>='
|
79
77
|
- !ruby/object:Gem::Version
|
@@ -81,70 +79,72 @@ dependencies:
|
|
81
79
|
- - ! '!='
|
82
80
|
- !ruby/object:Gem::Version
|
83
81
|
version: 0.9.0
|
82
|
+
none: false
|
83
|
+
prerelease: false
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name: rails
|
86
85
|
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
86
|
requirements:
|
89
87
|
- - ! '>='
|
90
88
|
- !ruby/object:Gem::Version
|
91
89
|
version: '3'
|
90
|
+
none: false
|
92
91
|
type: :development
|
93
|
-
|
92
|
+
name: rails
|
94
93
|
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
94
|
requirements:
|
97
95
|
- - ! '>='
|
98
96
|
- !ruby/object:Gem::Version
|
99
97
|
version: '3'
|
98
|
+
none: false
|
99
|
+
prerelease: false
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
|
-
name: rspec
|
102
101
|
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
102
|
requirements:
|
105
103
|
- - ! '>='
|
106
104
|
- !ruby/object:Gem::Version
|
107
105
|
version: '2'
|
106
|
+
none: false
|
108
107
|
type: :development
|
109
|
-
|
108
|
+
name: rspec
|
110
109
|
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
110
|
requirements:
|
113
111
|
- - ! '>='
|
114
112
|
- !ruby/object:Gem::Version
|
115
113
|
version: '2'
|
114
|
+
none: false
|
115
|
+
prerelease: false
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
|
-
name: rspec-rails
|
118
117
|
requirement: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
118
|
requirements:
|
121
119
|
- - ! '>='
|
122
120
|
- !ruby/object:Gem::Version
|
123
121
|
version: '2'
|
122
|
+
none: false
|
124
123
|
type: :development
|
125
|
-
|
124
|
+
name: rspec-rails
|
126
125
|
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
126
|
requirements:
|
129
127
|
- - ! '>='
|
130
128
|
- !ruby/object:Gem::Version
|
131
129
|
version: '2'
|
130
|
+
none: false
|
131
|
+
prerelease: false
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
|
-
name: redcarpet
|
134
133
|
requirement: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
134
|
requirements:
|
137
135
|
- - ! '>='
|
138
136
|
- !ruby/object:Gem::Version
|
139
137
|
version: '0'
|
138
|
+
none: false
|
140
139
|
type: :development
|
141
|
-
|
140
|
+
name: redcarpet
|
142
141
|
version_requirements: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
142
|
requirements:
|
145
143
|
- - ! '>='
|
146
144
|
- !ruby/object:Gem::Version
|
147
145
|
version: '0'
|
146
|
+
none: false
|
147
|
+
prerelease: false
|
148
148
|
description: ! " Out-of-box R18n support for Ruby on Rails.\n It is just a wrapper
|
149
149
|
for R18n Rails API and R18n core libraries.\n R18n has nice Ruby-style syntax,
|
150
150
|
filters, flexible locales, custom loaders,\n translation support for any classes,
|
@@ -203,23 +203,23 @@ rdoc_options: []
|
|
203
203
|
require_paths:
|
204
204
|
- lib
|
205
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
206
|
-
none: false
|
207
206
|
requirements:
|
208
207
|
- - ! '>='
|
209
208
|
- !ruby/object:Gem::Version
|
209
|
+
hash: 147309096012253799
|
210
210
|
version: '0'
|
211
211
|
segments:
|
212
212
|
- 0
|
213
|
-
hash: -1268755804857414664
|
214
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
213
|
none: false
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
215
|
requirements:
|
217
216
|
- - ! '>='
|
218
217
|
- !ruby/object:Gem::Version
|
218
|
+
hash: 147309096012253799
|
219
219
|
version: '0'
|
220
220
|
segments:
|
221
221
|
- 0
|
222
|
-
|
222
|
+
none: false
|
223
223
|
requirements: []
|
224
224
|
rubyforge_project:
|
225
225
|
rubygems_version: 1.8.23
|