ghost_reader 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Guardfile +9 -0
- data/README.md +35 -0
- data/Rakefile +7 -0
- data/doc/ARCH.md +54 -0
- data/doc/SPEC.md +138 -0
- data/doc/request_mockups.rb +40 -0
- data/ghost_reader.gemspec +35 -0
- data/lib/ghost_reader/backend.rb +161 -0
- data/lib/ghost_reader/client.rb +91 -0
- data/lib/ghost_reader/version.rb +3 -0
- data/lib/ghost_reader.rb +4 -0
- data/lib/tasks/ghost_reader.rake +62 -0
- data/lib/tasks/templates/ghost_reader.rb +14 -0
- data/spec/ghost_reader/backend_spec.rb +76 -0
- data/spec/ghost_reader/client_spec.rb +97 -0
- data/spec/ghost_reader/ghost_reader_spec.rb +491 -0
- data/spec/spec_helper.rb +109 -0
- metadata +247 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GhostReader::Backend do
|
4
|
+
|
5
|
+
context 'on class level' do
|
6
|
+
it 'should nicely initialize' do
|
7
|
+
backend = GhostReader::Backend.new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'Backend set up with fallback' do
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
@translation = 'This is a test.'
|
15
|
+
@fallback = mock "FallbackBackend"
|
16
|
+
@fallback.stub!(:translate).and_return(@translation)
|
17
|
+
@backend = GhostReader::Backend.new(:fallback => @fallback)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should use the given fallback' do
|
21
|
+
@backend.config.fallback.should be(@fallback)
|
22
|
+
@fallback.should_receive(:translate)
|
23
|
+
@backend.translate(:en, 'this.is.a.test').should eq(@translation)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should track missings' do
|
27
|
+
@backend.missings = {} # fake init
|
28
|
+
@backend.translate(:en, 'this.is.a.test')
|
29
|
+
@backend.missings.keys.should eq(['this.is.a.test'])
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should use memoization' do
|
33
|
+
@fallback.should_receive(:translate).exactly(1)
|
34
|
+
2.times { @backend.translate(:en, 'this.is.a.test').should eq(@translation) }
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should symbolize keys' do
|
38
|
+
test_data = { "one" => "1", "two" => "2"}
|
39
|
+
result = @backend.send(:symbolize_keys, test_data)
|
40
|
+
result.has_key?(:one).should be_true
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'nicely merge data into memoized_hash' do
|
44
|
+
|
45
|
+
it 'should work with valid data' do
|
46
|
+
data = {'en' => {'this' => {'is' => {'a' => {'test' => 'This is a test.'}}}}}
|
47
|
+
@backend.send(:memoize_merge!, data)
|
48
|
+
@backend.send(:memoized_lookup).should have_key(:en)
|
49
|
+
# flattend and symbolized
|
50
|
+
@backend.send(:memoized_lookup)[:en].should have_key(:'this.is.a.test')
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should handle weird data gracefully' do
|
54
|
+
expect do
|
55
|
+
data = {'en' => {'value_is_an_hash' => {'1st' => 'bla', '2nd' => 'blub'}}}
|
56
|
+
@backend.send(:memoize_merge!, data)
|
57
|
+
data = {'en' => {'empty_value' => ''}}
|
58
|
+
@backend.send(:memoize_merge!, data)
|
59
|
+
data = {'en' => {'' => 'Empty key.'}}
|
60
|
+
@backend.send(:memoize_merge!, data) # 'interning empty string'
|
61
|
+
data = {'en' => {'value_is_an_array' => %w(what the fuck)}}
|
62
|
+
@backend.send(:memoize_merge!, data)
|
63
|
+
end.to_not raise_error
|
64
|
+
end
|
65
|
+
|
66
|
+
# key should not be empty but if it is...
|
67
|
+
it 'should not raise error when key is empty' do
|
68
|
+
data = {'en' => {'' => 'Empty key.'}}
|
69
|
+
@backend.send(:memoize_merge!, data) # 'interning empty string'
|
70
|
+
@backend.send(:memoized_lookup).should be_empty
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
Excon.mock = true
|
4
|
+
|
5
|
+
module Excon
|
6
|
+
def self.kill_stubs!
|
7
|
+
@stubs = nil
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe GhostReader::Client do
|
12
|
+
|
13
|
+
context 'on class level' do
|
14
|
+
it 'should nicely initialize' do
|
15
|
+
GhostReader::Client.new.should be_an_instance_of(GhostReader::Client)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'a initialized client' do
|
20
|
+
|
21
|
+
let(:client) { GhostReader::Client.new(:api_key => 'some+api_key') }
|
22
|
+
|
23
|
+
before(:each) { Excon.kill_stubs! }
|
24
|
+
|
25
|
+
it 'should nicely respond to initial_request' do
|
26
|
+
body = {'some json' => 'here'}
|
27
|
+
Excon.stub( { :method => :get },
|
28
|
+
{ :body => body.to_json,
|
29
|
+
:status => 200,
|
30
|
+
:headers => { "last-modified" => httpdate } } )
|
31
|
+
response = client.initial_request
|
32
|
+
response[:status].should eq(200)
|
33
|
+
response[:data].should eq(body)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should try to reconnect configured number of times if there is timeout' do
|
37
|
+
body = { 'some json' => 'here' }
|
38
|
+
Excon.stub( { :method => :get },
|
39
|
+
{ :body => body.to_json,
|
40
|
+
:status => 408,
|
41
|
+
:headers => { "last-modified" => httpdate } } )
|
42
|
+
|
43
|
+
client.config.logger.should_receive(:error).exactly(3).times
|
44
|
+
|
45
|
+
response = client.initial_request
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should nicely respond to reporting_request' do
|
49
|
+
some_data = { 'some' => 'data' }
|
50
|
+
Excon.stub( { :method => :post },
|
51
|
+
{ :body => nil,
|
52
|
+
:status => 302 } )
|
53
|
+
response = client.reporting_request(some_data)
|
54
|
+
response[:status].should eq(302)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should log error if reporting_request response is not a redirect' do
|
58
|
+
some_data = { 'some' => 'data' }
|
59
|
+
Excon.stub( { :method => :post },
|
60
|
+
{ :body => nil,
|
61
|
+
:status => 200 })
|
62
|
+
|
63
|
+
client.config.logger.should_receive(:error)
|
64
|
+
|
65
|
+
response = client.reporting_request(some_data)
|
66
|
+
response[:status].should eq(200)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should nicely respond to incremental_request with 200' do
|
70
|
+
body = {'some json' => 'here'}
|
71
|
+
Excon.stub( { :method => :get },
|
72
|
+
{ :body => body.to_json,
|
73
|
+
:status => 200,
|
74
|
+
:headers => { "last-modified" => httpdate } } )
|
75
|
+
response = client.incremental_request
|
76
|
+
response[:status].should eq(200)
|
77
|
+
response[:data].should eq(body)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should nicely respond to incremental_request with 304' do
|
81
|
+
Excon.stub( { :method => :get },
|
82
|
+
{ :body => nil,
|
83
|
+
:status => 304,
|
84
|
+
:headers => { "last-modified" => httpdate } } )
|
85
|
+
response = client.incremental_request
|
86
|
+
response[:status].should eq(304)
|
87
|
+
response[:data].should be_nil
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
def httpdate(time=Time.now)
|
93
|
+
time.strftime('%a, %d %b %Y %H:%M:%S %Z')
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
@@ -0,0 +1,491 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "Ghost Reader" do
|
3
|
+
#before(:all) do
|
4
|
+
## I18n.locale=:en
|
5
|
+
#fallback = I18n::Backend::Simple.new
|
6
|
+
#fallback.store_translations(:en, {:notfound=>'Not found',
|
7
|
+
#:scoped=>{:fallback=>'fallback_value'},
|
8
|
+
#:time=>{
|
9
|
+
#:formats=>{
|
10
|
+
#:default=>'%Y-%d-%m'}
|
11
|
+
#},
|
12
|
+
#'activerecord'=>{
|
13
|
+
#'errors'=>{
|
14
|
+
#'messages'=>{
|
15
|
+
#'even'=>'Even value'
|
16
|
+
#}
|
17
|
+
#}
|
18
|
+
#},
|
19
|
+
#:hash_and_string => 'String value',
|
20
|
+
#:string_and_hash => {:k1=>'v1'}
|
21
|
+
|
22
|
+
#})
|
23
|
+
#fallback.store_translations(:de, {:notfound=>'Nicht gefunden'})
|
24
|
+
#fallback.store_translations(:pt, {:dummy=>''})
|
25
|
+
## Initializes a Handler
|
26
|
+
#@handler=GhostHandler.new
|
27
|
+
## Start a Mongrel-Server for Testing Ghost Reader
|
28
|
+
#@server = Mongrel::HttpServer.new('0.0.0.0', 35623)
|
29
|
+
#@server.register('/', @handler)
|
30
|
+
#@server.run
|
31
|
+
## Short Wait-Time for Testing
|
32
|
+
#I18n.backend = GhostReader::Backend.new("http://localhost:35623/",
|
33
|
+
#:default_backend => fallback,
|
34
|
+
#:wait_time => 1,
|
35
|
+
#:trace => Proc.new do |message|
|
36
|
+
#puts message
|
37
|
+
#end)
|
38
|
+
## Wait for finishing first call in background
|
39
|
+
#sleep 3
|
40
|
+
#end
|
41
|
+
|
42
|
+
#after(:all) do
|
43
|
+
## Shutdown the Mongrel-Server
|
44
|
+
#@server.stop
|
45
|
+
#end
|
46
|
+
|
47
|
+
##describe "#application_start" do
|
48
|
+
|
49
|
+
##end
|
50
|
+
|
51
|
+
##describe "#client_reports_missing_translation" do
|
52
|
+
|
53
|
+
##end
|
54
|
+
|
55
|
+
##describe "#client_receives_updated_translations" do
|
56
|
+
|
57
|
+
##end
|
58
|
+
|
59
|
+
##describe "#client_sends_all_translated_data_to_server" do
|
60
|
+
|
61
|
+
##end
|
62
|
+
|
63
|
+
#it('first call should not set if-modified-since') do
|
64
|
+
#@handler.last_params["HTTP_IF_MODIFIED_SINCE"].should == nil
|
65
|
+
#end
|
66
|
+
|
67
|
+
#it('can translate the key "test"') do
|
68
|
+
#I18n.t('test').should == "hello1"
|
69
|
+
#end
|
70
|
+
|
71
|
+
#it('can handle scoped request') do
|
72
|
+
#I18n.t('test', :scope=>'scoped').should == "scoped_result"
|
73
|
+
#end
|
74
|
+
#it('can handle scoped fallback') do
|
75
|
+
#I18n.t('fallback', :scope=>'scoped').should == "fallback_value"
|
76
|
+
#end
|
77
|
+
|
78
|
+
#it('can Handle scoped request in array-notation') do
|
79
|
+
#I18n.t('fallback', :scope=>['scoped']).should == "fallback_value"
|
80
|
+
#end
|
81
|
+
|
82
|
+
#it('can handle bulk lookup') do
|
83
|
+
#I18n.t([:odd, :even], :scope => 'activerecord.errors.messages').should ==
|
84
|
+
#['Odd value', 'Even value']
|
85
|
+
#end
|
86
|
+
|
87
|
+
#it('can handle interpolation') do
|
88
|
+
#I18n.t(:thanks, :name=>'Jeremy').should == "Thanks Jeremy"
|
89
|
+
#end
|
90
|
+
|
91
|
+
#it('can handle pluralization') do
|
92
|
+
#I18n.t(:inbox, :count=>2).should == "2 messages"
|
93
|
+
#end
|
94
|
+
|
95
|
+
#it('can handle a explicit locale') do
|
96
|
+
#I18n.t(:thanks, :name=>'Jeremy', :locale=>:de).should == "Danke Jeremy"
|
97
|
+
#end
|
98
|
+
|
99
|
+
|
100
|
+
#it('can localize a time') do
|
101
|
+
#Time.now.should_not == nil
|
102
|
+
#end
|
103
|
+
|
104
|
+
#it('can format a size') do
|
105
|
+
#Helper.new.number_to_human_size(12389506).should == '11.8 MB'
|
106
|
+
#end
|
107
|
+
|
108
|
+
#it('Cache miss not the fallback') {
|
109
|
+
#I18n.t('notfound').should == "Not found"
|
110
|
+
#}
|
111
|
+
|
112
|
+
#it('can translate the key "test" with a update-post') do
|
113
|
+
#sleep 2
|
114
|
+
#I18n.t('test').should == "hello2"
|
115
|
+
#end
|
116
|
+
|
117
|
+
#it('hit recorded') do
|
118
|
+
#sleep 2
|
119
|
+
#@handler.last_hits.should == {"thanks"=>2,
|
120
|
+
#"scoped.test"=>1,
|
121
|
+
#"inbox.one"=>1,
|
122
|
+
#"inbox.other"=>1,
|
123
|
+
#"number.human.format.delimiter"=>1,
|
124
|
+
#"number.format.separator"=>3,
|
125
|
+
#"activerecord.errors.messages.odd"=>1,
|
126
|
+
#"test"=>1}
|
127
|
+
#end
|
128
|
+
|
129
|
+
## it('cache-miss with fallback-values') do
|
130
|
+
##@handler.last_miss.should =={
|
131
|
+
##"notfound"=>{
|
132
|
+
##"default"=>{"de"=>"Nicht gefunden", "en"=>"Not found"},
|
133
|
+
##"count"=>{"en"=>1}
|
134
|
+
##},
|
135
|
+
##"scoped.fallback"=>{
|
136
|
+
##"default"=>{"en"=>"fallback_value"},
|
137
|
+
##"count"=>{"en"=>2}
|
138
|
+
##},
|
139
|
+
##"activerecord.errors.messages.even"=>{
|
140
|
+
##"default"=>{"en"=>"Even value"},
|
141
|
+
##"count"=>{"en"=>1}
|
142
|
+
##},
|
143
|
+
##"number.format.delimiter"=>{
|
144
|
+
##"default"=>{"en"=>","},
|
145
|
+
##"count"=>{"en"=>3}
|
146
|
+
##},
|
147
|
+
##"number.format.precision"=>{
|
148
|
+
##"default"=>{"en"=>3},
|
149
|
+
##"count"=>{"en"=>3}
|
150
|
+
##},
|
151
|
+
##"number.format.strip_insignificant_zeros"=> {
|
152
|
+
##"default"=>{"en"=>false},
|
153
|
+
##"count"=>{"en"=>3}
|
154
|
+
##},
|
155
|
+
|
156
|
+
##"number.human.storage_units.format"=>{
|
157
|
+
##"default"=>{"en"=>"%n %u"},
|
158
|
+
##"count"=>{"en"=>1}
|
159
|
+
##},
|
160
|
+
##"number.format.significant"=>{
|
161
|
+
##"default"=>{"en"=>false},
|
162
|
+
##"count"=>{"en"=>3}
|
163
|
+
##},
|
164
|
+
##"number.human.format.strip_insignificant_zeros"=>{
|
165
|
+
##"default"=>{"en"=>true},
|
166
|
+
##"count"=>{"en"=>1}
|
167
|
+
##},
|
168
|
+
##"number.human.format.precision"=>{
|
169
|
+
##"default"=>{"en"=>3},
|
170
|
+
##"count"=>{"en"=>1}
|
171
|
+
##},
|
172
|
+
##"number.precision.format.delimiter"=>{
|
173
|
+
##"default"=>{"en"=>""},
|
174
|
+
##"count"=>{"en"=>1}
|
175
|
+
##},
|
176
|
+
##"number.format.strip_insignificant_zeros"=>{
|
177
|
+
##"default"=>{"en"=>false},
|
178
|
+
##"count"=>{"en"=>3}
|
179
|
+
##},
|
180
|
+
##"number.human.format.significant"=>{
|
181
|
+
##"default"=>{"en"=>true},
|
182
|
+
##"count"=>{"en"=>1}
|
183
|
+
##},
|
184
|
+
##"number.human.format.precision"=>{
|
185
|
+
##"default"=>{"en"=>3},
|
186
|
+
##"count"=>{"en"=>1}
|
187
|
+
##},
|
188
|
+
##"number.human.storage_units.units.mb"=>{
|
189
|
+
##"default"=>{"en"=>"MB"},
|
190
|
+
##"count"=>{"en"=>1}
|
191
|
+
##}
|
192
|
+
##}
|
193
|
+
##end
|
194
|
+
|
195
|
+
#it('if-modified-since is set') do
|
196
|
+
#@handler.last_params["HTTP_IF_MODIFIED_SINCE"].should_not be_nil
|
197
|
+
#end
|
198
|
+
#it('can translate the key "test" with a update-post') do
|
199
|
+
#@handler.not_modified=true
|
200
|
+
#@handler.modified='modified'
|
201
|
+
#sleep 2
|
202
|
+
#I18n.t('modified').should == "not_modified"
|
203
|
+
#end
|
204
|
+
#it('can push all data from Backend to server') {
|
205
|
+
#I18n.backend.push_all_backend_data
|
206
|
+
#@handler.last_miss.should == {
|
207
|
+
#"notfound"=>{
|
208
|
+
#"default"=>{
|
209
|
+
#"de"=>"Nicht gefunden",
|
210
|
+
#"en"=>"Not found"},
|
211
|
+
#'count'=>{}
|
212
|
+
#},
|
213
|
+
#'scoped.fallback'=>{
|
214
|
+
#'default'=>{
|
215
|
+
#'en'=>'fallback_value'
|
216
|
+
#},
|
217
|
+
#'count'=>{}
|
218
|
+
#},
|
219
|
+
#"time.formats.default"=>{
|
220
|
+
#"default"=>{
|
221
|
+
#"en"=>"%a, %d %b %Y %H:%M:%S %z"
|
222
|
+
#},
|
223
|
+
#"count"=>{}
|
224
|
+
#},
|
225
|
+
#"activerecord.errors.messages.even"=> {
|
226
|
+
#"default"=>{
|
227
|
+
#"en"=>"Even value"
|
228
|
+
#},
|
229
|
+
#"count"=>{}
|
230
|
+
#},
|
231
|
+
#'dummy'=>{
|
232
|
+
#'default'=>{
|
233
|
+
#'pt'=>''
|
234
|
+
#},
|
235
|
+
#'count'=>{}
|
236
|
+
#},
|
237
|
+
#"number.human.format.delimiter"=>{
|
238
|
+
#"default"=>{"en"=>""},
|
239
|
+
#"count"=>{}
|
240
|
+
#},
|
241
|
+
#"errors.messages.blank"=>{
|
242
|
+
#"default"=>{"en"=>"can't be blank"},
|
243
|
+
#"count"=>{}
|
244
|
+
#},
|
245
|
+
#"datetime.prompts.second"=>{
|
246
|
+
#"default"=>{"en"=>"Seconds"},
|
247
|
+
#"count"=>{}
|
248
|
+
#},
|
249
|
+
#"number.format.separator"=>{
|
250
|
+
#"default"=>{"en"=>"."},
|
251
|
+
#"count"=>{}
|
252
|
+
#},
|
253
|
+
#"errors.messages.not_a_number"=>{
|
254
|
+
#"default"=>{"en"=>"is not a number"},
|
255
|
+
#"count"=>{}
|
256
|
+
#},
|
257
|
+
#"support.array.last_word_connector"=>{
|
258
|
+
#"default"=>{"en"=>", and "},
|
259
|
+
#"count"=>{}
|
260
|
+
#},
|
261
|
+
#"errors.messages.empty"=>{
|
262
|
+
#"default"=>{"en"=>"can't be empty"},
|
263
|
+
#"count"=>{}
|
264
|
+
#},
|
265
|
+
#"number.human.storage_units.format"=>{
|
266
|
+
#"default"=>{"en"=>"%n %u"},
|
267
|
+
#"count"=>{}
|
268
|
+
#},
|
269
|
+
#"support.array.words_connector"=>{
|
270
|
+
#"default"=>{"en"=>", "},
|
271
|
+
#"count"=>{}
|
272
|
+
#},
|
273
|
+
#"number.format.delimiter"=>{
|
274
|
+
#"default"=>{"en"=>","},
|
275
|
+
#"count"=>{}
|
276
|
+
#},
|
277
|
+
#"datetime.distance_in_words.x_seconds.other"=>{
|
278
|
+
#"default"=>{"en"=>"%{count} seconds"},
|
279
|
+
#"count"=>{}
|
280
|
+
#},
|
281
|
+
#"datetime.prompts.minute"=>{
|
282
|
+
#"default"=>{"en"=>"Minute"},
|
283
|
+
#"count"=>{}
|
284
|
+
#},
|
285
|
+
#"datetime.distance_in_words.less_than_x_seconds.other"=>{
|
286
|
+
#"default"=>{"en"=>"less than %{count} seconds"},
|
287
|
+
#"count"=>{}
|
288
|
+
#},
|
289
|
+
#"support.array.two_words_connector"=>{
|
290
|
+
#"default"=>{"en"=>" and "},
|
291
|
+
#"count"=>{}
|
292
|
+
#},
|
293
|
+
#"datetime.distance_in_words.half_a_minute"=>{
|
294
|
+
#"default"=>{"en"=>"half a minute"},
|
295
|
+
#"count"=>{}
|
296
|
+
#},
|
297
|
+
#"errors.messages.equal_to"=>{
|
298
|
+
#"default"=>{"en"=>"must be equal to %{count}"},
|
299
|
+
#"count"=>{}
|
300
|
+
#},
|
301
|
+
#"errors.messages.not_an_integer"=>{
|
302
|
+
#"default"=>{"en"=>"must be an integer"},
|
303
|
+
#"count"=>{}
|
304
|
+
#},
|
305
|
+
#"datetime.distance_in_words.about_x_years.one"=>{
|
306
|
+
#"default"=>{"en"=>"about 1 year"},
|
307
|
+
#"count"=>{}
|
308
|
+
#},
|
309
|
+
#"datetime.distance_in_words.x_minutes.other"=>{
|
310
|
+
#"default"=>{"en"=>"%{count} minutes"},
|
311
|
+
#"count"=>{}
|
312
|
+
#},
|
313
|
+
#"number.currency.format.delimiter"=>{
|
314
|
+
#"default"=>{"en"=>","},
|
315
|
+
#"count"=>{}},
|
316
|
+
#"number.human.storage_units.units.mb"=>{
|
317
|
+
#"default"=>{"en"=>"MB"},
|
318
|
+
#"count"=>{}},
|
319
|
+
#"date.formats.default"=>{
|
320
|
+
#"default"=>{"en"=>"%Y-%m-%d"},
|
321
|
+
#"count"=>{}},
|
322
|
+
#"datetime.distance_in_words.less_than_x_minutes.other"=>{
|
323
|
+
#"default"=>{"en"=>"less than %{count} minutes"},
|
324
|
+
#"count"=>{}},
|
325
|
+
#"helpers.select.prompt"=>{
|
326
|
+
#"default"=>{"en"=>"Please select"},
|
327
|
+
#"count"=>{}},
|
328
|
+
#"datetime.prompts.month"=>{
|
329
|
+
#"default"=>{"en"=>"Month"},
|
330
|
+
#"count"=>{}},
|
331
|
+
#"datetime.prompts.year"=>{
|
332
|
+
#"default"=>{"en"=>"Year"},
|
333
|
+
#"count"=>{}},
|
334
|
+
#"number.human.storage_units.units.kb"=>{
|
335
|
+
#"default"=>{"en"=>"KB"},
|
336
|
+
#"count"=>{}},
|
337
|
+
#"number.human.decimal_units.units.unit"=>{
|
338
|
+
#"default"=>{"en"=>""},
|
339
|
+
#"count"=>{}},
|
340
|
+
#"datetime.distance_in_words.x_days.other"=>{
|
341
|
+
#"default"=>{"en"=>"%{count} days"},
|
342
|
+
#"count"=>{}},
|
343
|
+
#"datetime.distance_in_words.about_x_hours.one"=>{
|
344
|
+
#"default"=>{"en"=>"about 1 hour"},
|
345
|
+
#"count"=>{}},
|
346
|
+
#"errors.messages.too_long"=>{
|
347
|
+
#"default"=>{
|
348
|
+
#"en"=>"is too long (maximum is %{count} characters)"
|
349
|
+
#},
|
350
|
+
#"count"=>{}},
|
351
|
+
#"number.currency.format.unit"=>{"default"=>{"en"=>"$"},
|
352
|
+
#"count"=>{}},
|
353
|
+
#"errors.messages.invalid"=>{
|
354
|
+
#"default"=>{"en"=>"is invalid"},
|
355
|
+
#"count"=>{}},
|
356
|
+
#"datetime.distance_in_words.almost_x_years.one"=>{
|
357
|
+
#"default"=>{"en"=>"almost 1 year"},
|
358
|
+
#"count"=>{}},
|
359
|
+
#"datetime.distance_in_words.about_x_months.other"=>{
|
360
|
+
#"default"=>{"en"=>"about %{count} months"},
|
361
|
+
#"count"=>{}},
|
362
|
+
#"errors.messages.inclusion"=>{
|
363
|
+
#"default"=>{"en"=>"is not included in the list"},
|
364
|
+
#"count"=>{}},
|
365
|
+
#"errors.messages.odd"=>{
|
366
|
+
#"default"=>{"en"=>"must be odd"},
|
367
|
+
#"count"=>{}},
|
368
|
+
#"datetime.distance_in_words.about_x_years.other"=>{
|
369
|
+
#"default"=>{"en"=>"about %{count} years"},
|
370
|
+
#"count"=>{}},
|
371
|
+
#"time.am"=>{
|
372
|
+
#"default"=>{"en"=>"am"},
|
373
|
+
#"count"=>{}},
|
374
|
+
#"datetime.distance_in_words.almost_x_years.other"=>{
|
375
|
+
#"default"=>{"en"=>"almost %{count} years"},
|
376
|
+
#"count"=>{}},
|
377
|
+
#"helpers.submit.submit"=>{
|
378
|
+
#"default"=>{"en"=>"Save %{model}"},
|
379
|
+
#"count"=>{}},
|
380
|
+
#"number.human.storage_units.units.byte.other"=>{
|
381
|
+
#"default"=>{"en"=>"Bytes"},
|
382
|
+
#"count"=>{}},
|
383
|
+
#"errors.messages.even"=>{
|
384
|
+
#"default"=>{"en"=>"must be even"},
|
385
|
+
#"count"=>{}},
|
386
|
+
#"number.human.storage_units.units.gb"=>{
|
387
|
+
#"default"=>{"en"=>"GB"},
|
388
|
+
#"count"=>{}},
|
389
|
+
#"datetime.distance_in_words.x_minutes.one"=>{
|
390
|
+
#"default"=>{"en"=>"1 minute"},
|
391
|
+
#"count"=>{}},
|
392
|
+
#"datetime.distance_in_words.about_x_hours.other"=>{
|
393
|
+
#"default"=>{"en"=>"about %{count} hours"},
|
394
|
+
#"count"=>{}},
|
395
|
+
#"number.human.decimal_units.units.thousand"=>{
|
396
|
+
#"default"=>{"en"=>"Thousand"},
|
397
|
+
#"count"=>{}},
|
398
|
+
#"errors.messages.less_than_or_equal_to"=>{
|
399
|
+
#"default"=>{"en"=>"must be less than or equal to %{count}"},
|
400
|
+
#"count"=>{}},
|
401
|
+
#"time.pm"=>{
|
402
|
+
#"default"=>{"en"=>"pm"},
|
403
|
+
#"count"=>{}},
|
404
|
+
#"datetime.distance_in_words.x_days.one"=>{
|
405
|
+
#"default"=>{"en"=>"1 day"},
|
406
|
+
#"count"=>{}},
|
407
|
+
#"errors.messages.less_than"=>{
|
408
|
+
#"default"=>{"en"=>"must be less than %{count}"},
|
409
|
+
#"count"=>{}},
|
410
|
+
#"number.percentage.format.delimiter"=>{
|
411
|
+
#"default"=>{"en"=>""},
|
412
|
+
#"count"=>{}},
|
413
|
+
#"number.human.decimal_units.units.trillion"=>{
|
414
|
+
#"default"=>{"en"=>"Trillion"},
|
415
|
+
#"count"=>{}},
|
416
|
+
#"number.precision.format.delimiter"=>{
|
417
|
+
#"default"=>{"en"=>""},
|
418
|
+
#"count"=>{}},
|
419
|
+
#"time.formats.short"=>{
|
420
|
+
#"default"=>{"en"=>"%d %b %H:%M"},
|
421
|
+
#"count"=>{}},
|
422
|
+
#"number.currency.format.format"=>{
|
423
|
+
#"default"=>{"en"=>"%u%n"},
|
424
|
+
#"count"=>{}},
|
425
|
+
#"number.human.storage_units.units.tb"=>{
|
426
|
+
#"default"=>{"en"=>"TB"},
|
427
|
+
#"count"=>{}},
|
428
|
+
#"errors.messages.confirmation"=>{
|
429
|
+
#"default"=>{"en"=>"doesn't match confirmation"},
|
430
|
+
#"count"=>{}},
|
431
|
+
#"datetime.distance_in_words.over_x_years.other"=>{
|
432
|
+
#"default"=>{"en"=>"over %{count} years"},
|
433
|
+
#"count"=>{}},
|
434
|
+
#"helpers.submit.update"=>{
|
435
|
+
#"default"=>{"en"=>"Update %{model}"},
|
436
|
+
#"count"=>{}},
|
437
|
+
#"number.human.decimal_units.units.quadrillion"=>{
|
438
|
+
#"default"=>{"en"=>"Quadrillion"},
|
439
|
+
#"count"=>{}},
|
440
|
+
#"datetime.distance_in_words.x_months.one"=>{
|
441
|
+
#"default"=>{"en"=>"1 month"},
|
442
|
+
#"count"=>{}},
|
443
|
+
#"datetime.distance_in_words.less_than_x_minutes.one"=>{
|
444
|
+
#"default"=>{"en"=>"less than a minute"},
|
445
|
+
#"count"=>{}},
|
446
|
+
#"errors.messages.greater_than"=>{
|
447
|
+
#"default"=>{"en"=>"must be greater than %{count}"},
|
448
|
+
#"count"=>{}},
|
449
|
+
#"number.human.decimal_units.format"=>{
|
450
|
+
#"default"=>{"en"=>"%n %u"},
|
451
|
+
#"count"=>{}},
|
452
|
+
#"datetime.prompts.day"=>{"default"=>{"en"=>"Day"}, "count"=>{}},
|
453
|
+
#"date.formats.short"=>{"default"=>{"en"=>"%b %d"}, "count"=>{}},
|
454
|
+
#"datetime.prompts.hour"=>{"default"=>{"en"=>"Hour"}, "count"=>{}},
|
455
|
+
#"number.human.decimal_units.units.billion"=>{"default"=>{"en"=>"Billion"}, "count"=>{}},
|
456
|
+
#"number.currency.format.separator"=>{"default"=>{"en"=>"."}, "count"=>{}},
|
457
|
+
#"time.formats.long"=>{"default"=>{"en"=>"%B %d, %Y %H:%M"}, "count"=>{}},
|
458
|
+
#"errors.format"=>{"default"=>{"en"=>"%{attribute} %{message}"}, "count"=>{}},
|
459
|
+
#"errors.messages.wrong_length"=>{"default"=>{"en"=>"is the wrong length (should be %{count} characters)"}, "count"=>{}},
|
460
|
+
#"number.human.storage_units.units.byte.one"=>{"default"=>{"en"=>"Byte"}, "count"=>{}},
|
461
|
+
#"errors.messages.exclusion"=>{"default"=>{"en"=>"is reserved"}, "count"=>{}},
|
462
|
+
#"errors.messages.greater_than_or_equal_to"=>{"default"=>{"en"=>"must be greater than or equal to %{count}"}, "count"=>{}},
|
463
|
+
#"errors.messages.accepted"=>{"default"=>{"en"=>"must be accepted"}, "count"=>{}},
|
464
|
+
#"errors.messages.too_short"=>{"default"=>{"en"=>"is too short (minimum is %{count} characters)"}, "count"=>{}},
|
465
|
+
#"helpers.submit.create"=>{"default"=>{"en"=>"Create %{model}"}, "count"=>{}},
|
466
|
+
#"datetime.distance_in_words.x_months.other"=>{"default"=>{"en"=>"%{count} months"}, "count"=>{}},
|
467
|
+
#"datetime.distance_in_words.x_seconds.one"=>{"default"=>{"en"=>"1 second"}, "count"=>{}},
|
468
|
+
#"datetime.distance_in_words.about_x_months.one"=>{"default"=>{"en"=>"about 1 month"}, "count"=>{}},
|
469
|
+
#"date.formats.long"=>{"default"=>{"en"=>"%B %d, %Y"}, "count"=>{}},
|
470
|
+
#"number.human.decimal_units.units.million"=>{"default"=>{"en"=>"Million"}, "count"=>{}},
|
471
|
+
#"datetime.distance_in_words.over_x_years.one"=>{"default"=>{"en"=>"over 1 year"}, "count"=>{}},
|
472
|
+
#"datetime.distance_in_words.less_than_x_seconds.one"=>{"default"=>{"en"=>"less than 1 second"}, "count"=>{}},
|
473
|
+
#"hash_and_string"=>{"default"=>{"en"=>"String value"}, "count"=>{}},
|
474
|
+
#"string_and_hash.k1"=>{"default"=>{"en"=>"v1"}, "count"=>{}}
|
475
|
+
#}
|
476
|
+
#}
|
477
|
+
#it('can read available locales from default-Backend and from ghost-server') {
|
478
|
+
#available_locales = I18n.backend.available_locales
|
479
|
+
#available_locales.include?(:de).should == true
|
480
|
+
#available_locales.include?(:pt).should == true
|
481
|
+
#available_locales.include?(:es).should == true
|
482
|
+
#}
|
483
|
+
|
484
|
+
#it('can handle hash-map with string as fallback value') do
|
485
|
+
#I18n.t('hash_and_string').should == {:k1=>'v1', :k2=>'v2'}
|
486
|
+
#end
|
487
|
+
|
488
|
+
#it('can handle a string value with a hash as fallback value') do
|
489
|
+
#I18n.t('string_and_hash').should == "String value"
|
490
|
+
#end
|
491
|
+
end
|