sinatra-r18n 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,39 +1,42 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-r18n (0.4.10)
5
- r18n-core (= 0.4.10)
6
- sinatra (>= 0.9)
4
+ sinatra-r18n (0.4.11)
5
+ r18n-core (= 0.4.11)
6
+ sinatra (>= 1.3)
7
7
 
8
8
  PATH
9
9
  remote: ../r18n-core/
10
10
  specs:
11
- r18n-core (0.4.10)
11
+ r18n-core (0.4.11)
12
12
 
13
13
  GEM
14
14
  remote: http://rubygems.org/
15
15
  specs:
16
- diff-lcs (1.1.2)
16
+ diff-lcs (1.1.3)
17
17
  haml (2.2.24)
18
18
  hanna (0.1.12)
19
19
  haml (~> 2.2.8)
20
20
  rake (~> 0.8.2)
21
21
  rdoc (~> 2.3.0)
22
- psych (1.2.0)
23
- rack (1.2.2)
24
- rack-test (0.5.7)
22
+ psych (1.2.1)
23
+ rack (1.3.4)
24
+ rack-protection (1.1.2)
25
+ rack
26
+ rack-test (0.6.1)
25
27
  rack (>= 1.0)
26
28
  rake (0.8.7)
27
- rcov (0.9.9)
29
+ rcov (0.9.10)
28
30
  rdoc (2.3.0)
29
- rspec-core (2.5.1)
30
- rspec-expectations (2.5.0)
31
+ rspec-core (2.6.4)
32
+ rspec-expectations (2.6.0)
31
33
  diff-lcs (~> 1.1.2)
32
- rspec-mocks (2.5.0)
33
- sinatra (1.2.6)
34
- rack (~> 1.1)
35
- tilt (>= 1.2.2, < 2.0)
36
- tilt (1.3)
34
+ rspec-mocks (2.6.0)
35
+ sinatra (1.3.0)
36
+ rack (~> 1.3)
37
+ rack-protection (~> 1.1)
38
+ tilt (~> 1.3)
39
+ tilt (1.3.3)
37
40
 
38
41
  PLATFORMS
39
42
  ruby
data/README.rdoc CHANGED
@@ -82,6 +82,11 @@ You can change default locale and translations dir:
82
82
  set :default_locale, 'ru'
83
83
  set :translations, './translations'
84
84
 
85
+ You can also provide an Array of translations directories, which may be
86
+ useful, for instance, in a plugin-based architecture:
87
+
88
+ set :translations, Dir.glob('./myplugins/*/i18n')
89
+
85
90
  == License
86
91
 
87
92
  R18n is licensed under the GNU Lesser General Public License version 3.
data/Rakefile CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'rubygems'
4
4
 
5
5
  begin
6
- require 'bundler'
7
6
  require 'bundler/setup'
8
7
  Bundler::GemHelper.install_tasks
9
8
  rescue LoadError
data/lib/sinatra/r18n.rb CHANGED
@@ -27,26 +27,26 @@ module Sinatra #::nodoc::
27
27
  app.helpers ::R18n::Helpers
28
28
  app.set :default_locale, 'en'
29
29
  app.set :translations, Proc.new { File.join(app.root, 'i18n/') }
30
-
30
+
31
31
  app.before do
32
32
  ::R18n.set do
33
- ::R18n::I18n.default = options.default_locale
34
-
33
+ ::R18n::I18n.default = settings.default_locale
34
+
35
35
  locales = ::R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE'])
36
36
  if params[:locale]
37
37
  locales.insert(0, params[:locale])
38
38
  elsif session[:locale]
39
39
  locales.insert(0, session[:locale])
40
40
  end
41
-
42
- ::R18n::I18n.new(locales, options.translations)
41
+
42
+ ::R18n::I18n.new(locales, settings.translations)
43
43
  end
44
44
  end
45
-
45
+
46
46
  ::R18n::Filters.off(:untranslated)
47
47
  ::R18n::Filters.on(:untranslated_html)
48
48
  end
49
49
  end
50
-
50
+
51
51
  register R18n
52
52
  end
data/sinatra-r18n.gemspec CHANGED
@@ -20,16 +20,15 @@ Gem::Specification.new do |s|
20
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
21
  s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
22
22
  s.require_path = 'lib'
23
- s.has_rdoc = true
24
23
 
25
24
  s.author = 'Andrey "A.I." Sitnik'
26
25
  s.email = 'andrey@sitnik.ru'
27
26
  s.homepage = 'http://r18n.rubyforge.org/'
28
27
  s.rubyforge_project = 'sinatra-r18n'
29
28
 
30
- s.add_dependency 'sinatra', [">= 0.9"]
29
+ s.add_dependency 'sinatra', [">= 1.3"]
31
30
  s.add_dependency 'r18n-core', ["= #{R18n::VERSION}"]
32
-
31
+
33
32
  s.add_development_dependency "bundler", [">= 1.0.10"]
34
33
  s.add_development_dependency "hanna", [">= 0"]
35
34
  s.add_development_dependency "rake", [">= 0", "!= 0.9.0"]
@@ -5,59 +5,59 @@ describe Sinatra::R18n do
5
5
  before(:all) do
6
6
  Sinatra::R18n.registered(app)
7
7
  end
8
-
8
+
9
9
  after do
10
10
  set :default_locale, 'en'
11
11
  set :environment, :test
12
12
  end
13
-
13
+
14
14
  it "should translate messages" do
15
15
  get '/en/posts/1'
16
16
  last_response.should be_ok
17
17
  last_response.body.should == "<h1>Post 1</h1>\n"
18
18
  end
19
-
19
+
20
20
  it "should use translations from default locale" do
21
21
  get '/ru/posts/1/comments'
22
22
  last_response.should be_ok
23
23
  last_response.body.should == '3 comments'
24
24
  end
25
-
25
+
26
26
  it "should use default locale" do
27
27
  set :default_locale, 'ru'
28
28
  get '/locale'
29
29
  last_response.should be_ok
30
30
  last_response.body.should == 'Русский'
31
31
  end
32
-
32
+
33
33
  it "should autodetect user locale" do
34
34
  get '/locale', {}, {'HTTP_ACCEPT_LANGUAGE' => 'ru,en;q=0.9'}
35
35
  last_response.should be_ok
36
36
  last_response.body.should == 'Русский'
37
37
  end
38
-
38
+
39
39
  it "should use locale from session" do
40
40
  get '/locale', {}, { 'rack.session' => { :locale => 'ru' } }
41
41
  last_response.should be_ok
42
42
  last_response.body.should == 'Русский'
43
43
  end
44
-
44
+
45
45
  it "should return locales list" do
46
46
  get '/locales'
47
47
  last_response.should be_ok
48
48
  last_response.body.should == 'en: English; ru: Русский'
49
49
  end
50
-
50
+
51
51
  it "should format untranslated string" do
52
52
  get '/untranslated'
53
53
  last_response.should be_ok
54
54
  last_response.body.should == 'post.<span style="color: red">no</span>'
55
55
  end
56
-
56
+
57
57
  it "should localize objects" do
58
58
  get '/time'
59
59
  last_response.should be_ok
60
60
  last_response.body.should == "01/01/1970 00:00"
61
61
  end
62
-
62
+
63
63
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-r18n
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 25
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 10
10
- version: 0.4.10
9
+ - 11
10
+ version: 0.4.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrey "A.I." Sitnik
@@ -15,41 +15,42 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-08 00:00:00 +04:00
19
- default_executable:
18
+ date: 2011-10-02 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
+ name: sinatra
22
23
  prerelease: false
23
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
28
- hash: 25
29
+ hash: 9
29
30
  segments:
30
- - 0
31
- - 9
32
- version: "0.9"
31
+ - 1
32
+ - 3
33
+ version: "1.3"
33
34
  requirement: *id001
34
- type: :runtime
35
- name: sinatra
36
35
  - !ruby/object:Gem::Dependency
36
+ type: :runtime
37
+ name: r18n-core
37
38
  prerelease: false
38
39
  version_requirements: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - "="
42
43
  - !ruby/object:Gem::Version
43
- hash: 27
44
+ hash: 25
44
45
  segments:
45
46
  - 0
46
47
  - 4
47
- - 10
48
- version: 0.4.10
48
+ - 11
49
+ version: 0.4.11
49
50
  requirement: *id002
50
- type: :runtime
51
- name: r18n-core
52
51
  - !ruby/object:Gem::Dependency
52
+ type: :development
53
+ name: bundler
53
54
  prerelease: false
54
55
  version_requirements: &id003 !ruby/object:Gem::Requirement
55
56
  none: false
@@ -63,9 +64,9 @@ dependencies:
63
64
  - 10
64
65
  version: 1.0.10
65
66
  requirement: *id003
66
- type: :development
67
- name: bundler
68
67
  - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ name: hanna
69
70
  prerelease: false
70
71
  version_requirements: &id004 !ruby/object:Gem::Requirement
71
72
  none: false
@@ -77,9 +78,9 @@ dependencies:
77
78
  - 0
78
79
  version: "0"
79
80
  requirement: *id004
80
- type: :development
81
- name: hanna
82
81
  - !ruby/object:Gem::Dependency
82
+ type: :development
83
+ name: rake
83
84
  prerelease: false
84
85
  version_requirements: &id005 !ruby/object:Gem::Requirement
85
86
  none: false
@@ -99,9 +100,9 @@ dependencies:
99
100
  - 0
100
101
  version: 0.9.0
101
102
  requirement: *id005
102
- type: :development
103
- name: rake
104
103
  - !ruby/object:Gem::Dependency
104
+ type: :development
105
+ name: rack-test
105
106
  prerelease: false
106
107
  version_requirements: &id006 !ruby/object:Gem::Requirement
107
108
  none: false
@@ -113,9 +114,9 @@ dependencies:
113
114
  - 0
114
115
  version: "0"
115
116
  requirement: *id006
116
- type: :development
117
- name: rack-test
118
117
  - !ruby/object:Gem::Dependency
118
+ type: :development
119
+ name: rspec-core
119
120
  prerelease: false
120
121
  version_requirements: &id007 !ruby/object:Gem::Requirement
121
122
  none: false
@@ -127,9 +128,9 @@ dependencies:
127
128
  - 0
128
129
  version: "0"
129
130
  requirement: *id007
130
- type: :development
131
- name: rspec-core
132
131
  - !ruby/object:Gem::Dependency
132
+ type: :development
133
+ name: rspec-expectations
133
134
  prerelease: false
134
135
  version_requirements: &id008 !ruby/object:Gem::Requirement
135
136
  none: false
@@ -141,9 +142,9 @@ dependencies:
141
142
  - 0
142
143
  version: "0"
143
144
  requirement: *id008
144
- type: :development
145
- name: rspec-expectations
146
145
  - !ruby/object:Gem::Dependency
146
+ type: :development
147
+ name: rspec-mocks
147
148
  prerelease: false
148
149
  version_requirements: &id009 !ruby/object:Gem::Requirement
149
150
  none: false
@@ -155,9 +156,9 @@ dependencies:
155
156
  - 0
156
157
  version: "0"
157
158
  requirement: *id009
158
- type: :development
159
- name: rspec-mocks
160
159
  - !ruby/object:Gem::Dependency
160
+ type: :development
161
+ name: rcov
161
162
  prerelease: false
162
163
  version_requirements: &id010 !ruby/object:Gem::Requirement
163
164
  none: false
@@ -169,8 +170,6 @@ dependencies:
169
170
  - 0
170
171
  version: "0"
171
172
  requirement: *id010
172
- type: :development
173
- name: rcov
174
173
  description: " A Sinatra extension that provides i18n support to translate your web\n application. It is just a wrapper for R18n core library.\n It has nice Ruby-style syntax, filters, flexible locales, custom loaders,\n translation support for any classes, time and number localization, several\n user language support, agnostic core package with out-of-box support for\n Rails, Sinatra, Merb and desktop applications.\n"
175
174
  email: andrey@sitnik.ru
176
175
  executables: []
@@ -195,7 +194,6 @@ files:
195
194
  - spec/app/views/post.erb
196
195
  - spec/sinatra-r18n_spec.rb
197
196
  - spec/spec_helper.rb
198
- has_rdoc: true
199
197
  homepage: http://r18n.rubyforge.org/
200
198
  licenses: []
201
199
 
@@ -225,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
223
  requirements: []
226
224
 
227
225
  rubyforge_project: sinatra-r18n
228
- rubygems_version: 1.3.7
226
+ rubygems_version: 1.7.2
229
227
  signing_key:
230
228
  specification_version: 3
231
229
  summary: A Sinatra extension that provides i18n support to translate your web application.