r18n-rails 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +4 -23
- data/r18n-rails.gemspec +1 -0
- data/spec/rails_spec.rb +22 -19
- metadata +46 -28
- data/.yardopts +0 -3
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f8336e36babc99de4c459c6f69dc5088090f7a27
|
4
|
+
data.tar.gz: c9ee26387f00388587d6afc4722c6750610197e3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4fcc1d967f473ba9e1d68e4fa970e62198afa5606c852f85a567dcc770940c51fe4bc1b4746dea18f7248eb89a05e8e075ff25cf30dfd1f5d09b0efc6e25b92
|
7
|
+
data.tar.gz: 15f69f4a82e08a7045e8120ae0cd97fa5873700ec4ae93f567548c6b0902527ee9905951d021c6b939cffb8a2709b9596bf5c0737839680c329167d4763102ee
|
data/Rakefile
CHANGED
@@ -1,32 +1,13 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
require 'rubygems'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
Bundler::GemHelper.install_tasks
|
7
|
-
rescue LoadError
|
8
|
-
puts "Bundler not available. Install it with: gem install bundler"
|
9
|
-
end
|
10
|
-
|
11
|
-
PKG_NAME = 'r18n-rails'
|
12
|
-
require '../r18n-core/lib/r18n-core/version'
|
3
|
+
require 'bundler/setup'
|
4
|
+
Bundler::GemHelper.install_tasks
|
13
5
|
|
14
6
|
require 'rspec/core/rake_task'
|
15
|
-
|
16
7
|
RSpec::Core::RakeTask.new
|
8
|
+
task :default => :spec
|
17
9
|
|
18
|
-
require 'yard'
|
19
|
-
YARD::Rake::YardocTask.new do |yard|
|
20
|
-
yard.options << "--title='R18n for Rails #{R18n::VERSION}'"
|
21
|
-
end
|
22
|
-
|
23
|
-
task :clobber_doc do
|
24
|
-
rm_r 'doc' rescue nil
|
25
|
-
rm_r '.yardoc' rescue nil
|
26
|
-
end
|
27
10
|
task :clobber_package do
|
28
11
|
rm_r 'pkg' rescue nil
|
29
12
|
end
|
30
|
-
task :clobber => [:clobber_package
|
31
|
-
|
32
|
-
task :default => :spec
|
13
|
+
task :clobber => [:clobber_package]
|
data/r18n-rails.gemspec
CHANGED
data/spec/rails_spec.rb
CHANGED
@@ -4,74 +4,74 @@ require File.expand_path('../spec_helper', __FILE__)
|
|
4
4
|
describe TestController, :type => :controller do
|
5
5
|
render_views
|
6
6
|
|
7
|
-
it
|
7
|
+
it "uses default locale" do
|
8
8
|
get :locales
|
9
9
|
response.should be_success
|
10
10
|
response.body.should == 'ru'
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it "gets locale from param" do
|
14
14
|
get :locales, :locale => 'ru'
|
15
15
|
response.should be_success
|
16
16
|
response.body.should == 'ru, en'
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it "gets locale from session" do
|
20
20
|
get :locales, {}, { :locale => 'ru' }
|
21
21
|
response.should be_success
|
22
22
|
response.body.should == 'ru, en'
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it "gets locales from http" do
|
26
26
|
request.env['HTTP_ACCEPT_LANGUAGE'] = 'ru,fr;q=0.9'
|
27
27
|
get :locales
|
28
28
|
response.should be_success
|
29
29
|
response.body.should == 'ru, fr, en'
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
32
|
+
it "loads translations" do
|
33
33
|
get :translations, :locale => 'en'
|
34
34
|
response.should be_success
|
35
35
|
response.body.should == 'R18n: supported. Rails I18n: supported'
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
38
|
+
it "returns available translations" do
|
39
39
|
get :available
|
40
40
|
response.should be_success
|
41
41
|
response.body.should == 'en ru'
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
44
|
+
it "adds helpers" do
|
45
45
|
get :helpers, :locale => 'en'
|
46
46
|
response.should be_success
|
47
47
|
response.body.should == "Name\nName\nName\nName\n"
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
50
|
+
it "formats untranslated" do
|
51
51
|
get :untranslated
|
52
52
|
response.should be_success
|
53
53
|
response.body.should == 'user.<span style="color: red">[not.exists]</span>'
|
54
54
|
end
|
55
55
|
|
56
|
-
it "
|
56
|
+
it "adds methods to controller" do
|
57
57
|
get :controller, :locale => 'en'
|
58
58
|
response.should be_success
|
59
59
|
response.body.should == "Name Name Name"
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
62
|
+
it "localizes time by Rails I18n" do
|
63
63
|
get :time, :locale => 'en'
|
64
64
|
response.should be_success
|
65
65
|
response.body.should == "Thu, 01 Jan 1970 00:00:00 +0000\n01 Jan 00:00"
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
68
|
+
it "localizes time by R18n" do
|
69
69
|
get :human_time, :locale => 'en'
|
70
70
|
response.should be_success
|
71
71
|
response.body.should == "now"
|
72
72
|
end
|
73
73
|
|
74
|
-
it "
|
74
|
+
it "translates models" do
|
75
75
|
ActiveRecord::Schema.verbose = false
|
76
76
|
ActiveRecord::Schema.define(:version => 20091218130034) do
|
77
77
|
create_table "posts", :force => true do |t|
|
@@ -97,19 +97,19 @@ describe TestController, :type => :controller do
|
|
97
97
|
@post.title.should == 'Запись'
|
98
98
|
end
|
99
99
|
|
100
|
-
it "
|
100
|
+
it "sets default places" do
|
101
101
|
R18n.default_places.should == [Rails.root.join('app/i18n'),
|
102
102
|
R18n::Loader::Rails.new]
|
103
103
|
R18n.set('en')
|
104
104
|
R18n.get.user.name.should == 'Name'
|
105
105
|
end
|
106
106
|
|
107
|
-
it "
|
107
|
+
it "translates mails" do
|
108
108
|
email = TestMailer.test.deliver
|
109
109
|
email.encoded.should =~ /Name\r\nName\r\nName\r\n$/
|
110
110
|
end
|
111
111
|
|
112
|
-
it "
|
112
|
+
it "reloads filters from app directory" do
|
113
113
|
get :filter, :locale => 'en'
|
114
114
|
response.should be_success
|
115
115
|
response.body.should == 'Rails'
|
@@ -122,21 +122,20 @@ describe TestController, :type => :controller do
|
|
122
122
|
response.body.should == 'Rails'
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "escapes html inside R18n" do
|
126
126
|
get :safe, :locale => 'en'
|
127
127
|
response.should be_success
|
128
128
|
response.body.should ==
|
129
129
|
"<b> user.<span style=\"color: red\">[no_tr]</span>\n"
|
130
130
|
end
|
131
131
|
|
132
|
-
|
133
|
-
it "should work with Rails build-in herlpers" do
|
132
|
+
it "works with Rails build-in herlpers" do
|
134
133
|
get :format
|
135
134
|
response.should be_success
|
136
135
|
response.body.should == "1 000,1 руб.\n"
|
137
136
|
end
|
138
137
|
|
139
|
-
it "
|
138
|
+
it "caches I18n object" do
|
140
139
|
R18n.clear_cache!
|
141
140
|
|
142
141
|
get :translations
|
@@ -153,4 +152,8 @@ describe TestController, :type => :controller do
|
|
153
152
|
R18n.cache.keys.length.should == 2
|
154
153
|
end
|
155
154
|
|
155
|
+
it "parameterizes strigns" do
|
156
|
+
'One two три'.parameterize.should == 'one-two'
|
157
|
+
end
|
158
|
+
|
156
159
|
end
|
metadata
CHANGED
@@ -1,37 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrey "A.I." Sitnik
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
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.7
|
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
|
-
version: 1.1.
|
30
|
-
description:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
version: 1.1.7
|
27
|
+
description: |2
|
28
|
+
Out-of-box R18n support for Ruby on Rails.
|
29
|
+
It is just a wrapper for R18n Rails API and R18n core libraries.
|
30
|
+
R18n has nice Ruby-style syntax, filters, flexible locales, custom loaders,
|
31
|
+
translation support for any classes, time and number localization, several
|
32
|
+
user language support, agnostic core package with out-of-box support for
|
33
|
+
Rails, Sinatra and desktop applications.
|
35
34
|
email: andrey@sitnik.ru
|
36
35
|
executables: []
|
37
36
|
extensions: []
|
@@ -40,7 +39,6 @@ extra_rdoc_files:
|
|
40
39
|
- LICENSE
|
41
40
|
files:
|
42
41
|
- .rspec
|
43
|
-
- .yardopts
|
44
42
|
- LICENSE
|
45
43
|
- README.md
|
46
44
|
- Rakefile
|
@@ -78,34 +76,54 @@ files:
|
|
78
76
|
- spec/rails_spec.rb
|
79
77
|
- spec/spec_helper.rb
|
80
78
|
homepage: https://github.com/ai/r18n/tree/master/r18n-rails
|
81
|
-
licenses:
|
79
|
+
licenses:
|
80
|
+
- LGPL-3
|
81
|
+
metadata: {}
|
82
82
|
post_install_message:
|
83
83
|
rdoc_options: []
|
84
84
|
require_paths:
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
87
|
requirements:
|
89
|
-
- -
|
88
|
+
- - '>='
|
90
89
|
- !ruby/object:Gem::Version
|
91
90
|
version: '0'
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
hash: 1963871319031755734
|
95
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
92
|
requirements:
|
98
|
-
- -
|
93
|
+
- - '>='
|
99
94
|
- !ruby/object:Gem::Version
|
100
95
|
version: '0'
|
101
|
-
segments:
|
102
|
-
- 0
|
103
|
-
hash: 1963871319031755734
|
104
96
|
requirements: []
|
105
97
|
rubyforge_project:
|
106
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.0.3
|
107
99
|
signing_key:
|
108
|
-
specification_version:
|
100
|
+
specification_version: 4
|
109
101
|
summary: R18n for Rails
|
110
|
-
test_files:
|
111
|
-
|
102
|
+
test_files:
|
103
|
+
- spec/app/app/controllers/application_controller.rb
|
104
|
+
- spec/app/app/controllers/test_controller.rb
|
105
|
+
- spec/app/app/helpers/application_helper.rb
|
106
|
+
- spec/app/app/i18n/en.yml
|
107
|
+
- spec/app/app/i18n/filters.rb
|
108
|
+
- spec/app/app/i18n/ru.yml
|
109
|
+
- spec/app/app/mailers/test_mailer.rb
|
110
|
+
- spec/app/app/models/post.rb
|
111
|
+
- spec/app/app/views/test/format.html.erb
|
112
|
+
- spec/app/app/views/test/helpers.html.erb
|
113
|
+
- spec/app/app/views/test/safe.html.erb
|
114
|
+
- spec/app/app/views/test_mailer/test.text.erb
|
115
|
+
- spec/app/config.ru
|
116
|
+
- spec/app/config/application.rb
|
117
|
+
- spec/app/config/boot.rb
|
118
|
+
- spec/app/config/environment.rb
|
119
|
+
- spec/app/config/environments/test.rb
|
120
|
+
- spec/app/config/initializers/r18n.rb
|
121
|
+
- spec/app/config/initializers/secret_token.rb
|
122
|
+
- spec/app/config/locales/en.yml
|
123
|
+
- spec/app/config/locales/ru.yml
|
124
|
+
- spec/app/config/routes.rb
|
125
|
+
- spec/app/db/migrate/20091218123631_create_posts.rb
|
126
|
+
- spec/app/db/schema.rb
|
127
|
+
- spec/app/script/rails
|
128
|
+
- spec/rails_spec.rb
|
129
|
+
- spec/spec_helper.rb
|
data/.yardopts
DELETED