r18n-rails 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/r18n-rails.rb +1 -2
- data/lib/r18n-rails/controller.rb +1 -1
- data/lib/r18n-rails/helpers.rb +15 -0
- data/spec/app/app/controllers/test_controller.rb +9 -0
- data/spec/app/log/test.log +2925 -0
- data/spec/rails_spec.rb +12 -0
- metadata +2 -3
- data/lib/r18n-rails/mixin.rb +0 -41
data/spec/rails_spec.rb
CHANGED
@@ -61,6 +61,18 @@ describe 'R18n for Rails', :type => :controller do
|
|
61
61
|
response.body.should == "NameNameName"
|
62
62
|
end
|
63
63
|
|
64
|
+
it "should localize time by Rails I18n" do
|
65
|
+
get :time, :locale => 'en'
|
66
|
+
response.should be_success
|
67
|
+
response.body.should == "Thu, 01 Jan 1970 00:00:00 +0000\n01 Jan 00:00"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should localize time by R18n" do
|
71
|
+
get :human_time, :locale => 'en'
|
72
|
+
response.should be_success
|
73
|
+
response.body.should == "now"
|
74
|
+
end
|
75
|
+
|
64
76
|
it "should translate models" do
|
65
77
|
ActiveRecord::Schema.verbose = false
|
66
78
|
ActiveRecord::Schema.define(:version => 20091218130034) do
|
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: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey "A.I." Sitnik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-29 00:00:00 +04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,6 @@ extra_rdoc_files:
|
|
32
32
|
- README.rdoc
|
33
33
|
- LICENSE
|
34
34
|
files:
|
35
|
-
- lib/r18n-rails/mixin.rb
|
36
35
|
- lib/r18n-rails/helpers.rb
|
37
36
|
- lib/r18n-rails/controller.rb
|
38
37
|
- lib/r18n-rails.rb
|
data/lib/r18n-rails/mixin.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
R18n methods for Rails helpers and controllers.
|
3
|
-
|
4
|
-
Copyright (C) 2009 Andrey “A.I.” Sitnik <andrey@sitnik.ru>
|
5
|
-
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
7
|
-
it under the terms of the GNU Lesser General Public License as published by
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
9
|
-
(at your option) any later version.
|
10
|
-
|
11
|
-
This program is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
GNU Lesser General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU Lesser General Public License
|
17
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
=end
|
19
|
-
|
20
|
-
module R18n
|
21
|
-
module Rails
|
22
|
-
module Mixin
|
23
|
-
# Return current R18n instance.
|
24
|
-
def r18n
|
25
|
-
R18n.get
|
26
|
-
end
|
27
|
-
|
28
|
-
# Extend +t+ helper to use also R18n syntax.
|
29
|
-
#
|
30
|
-
# t 'user.name' # Rails I18n style
|
31
|
-
# t.user.name # R18n style
|
32
|
-
def t(*params)
|
33
|
-
if params.empty?
|
34
|
-
r18n.t
|
35
|
-
else
|
36
|
-
super(*params)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|