gettext_activerecord 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_parser.rb CHANGED
@@ -2,73 +2,69 @@ require 'helper'
2
2
 
3
3
  require 'gettext_activerecord/tools'
4
4
 
5
- # setup the parser
6
- # Don't need this because DB connection is established in helper.rb.
7
- #GetText::ActiveRecordParser.init(
8
- # :adapter => 'sqlite3',
9
- # :database => ':memory:'
10
- #)
11
-
12
5
  class TestGetTextParser < Test::Unit::TestCase
6
+ def assert_parser(ary, po)
7
+ poary = [po.msgid, *po.sources]
8
+ assert_equal(ary, poary)
9
+ end
10
+
13
11
  def test_class
14
- GetText::ActiveRecordParser.target?("models/topic.rb")
15
- ary = GetText::ActiveRecordParser.parse("models/topic.rb")
12
+ ary = GetText::RGetText.parse("models/topic.rb")
16
13
  assert_equal(14, ary.size)
17
- assert_equal(["topic", "models/topic.rb:-"], ary[0])
18
- assert_equal(["Topic|Title", "models/topic.rb:-"], ary[1])
19
- assert_equal(["Topic|Author name", "models/topic.rb:-"], ary[2])
20
- assert_equal(["Topic|Author email address", "models/topic.rb:-"], ary[3])
21
- assert_equal(["Topic|Written on", "models/topic.rb:-"], ary[4])
22
- assert_equal(["Topic|Bonus time", "models/topic.rb:-"], ary[5])
23
- assert_equal(["Topic|Last read", "models/topic.rb:-"], ary[6])
24
- assert_equal(["Topic|Content", "models/topic.rb:-"], ary[7])
25
- assert_equal(["Topic|Approved", "models/topic.rb:-"], ary[8])
26
- assert_equal(["Topic|Replies count", "models/topic.rb:-"], ary[9])
27
- assert_equal(["Topic|Parent", "models/topic.rb:-"], ary[10])
28
- assert_equal(["Topic|Type", "models/topic.rb:-"], ary[11])
29
- assert_equal(["Topic|Terms of service", "models/topic.rb:35"], ary[12])
30
- assert_equal(["must be abided", "models/topic.rb:36"], ary[13])
14
+ assert_parser(["topic", "models/topic.rb:-"], ary[0])
15
+ assert_parser(["Topic|Title", "models/topic.rb:-"], ary[1])
16
+ assert_parser(["Topic|Author name", "models/topic.rb:-"], ary[2])
17
+ assert_parser(["Topic|Author email address", "models/topic.rb:-"], ary[3])
18
+ assert_parser(["Topic|Written on", "models/topic.rb:-"], ary[4])
19
+ assert_parser(["Topic|Bonus time", "models/topic.rb:-"], ary[5])
20
+ assert_parser(["Topic|Last read", "models/topic.rb:-"], ary[6])
21
+ assert_parser(["Topic|Content", "models/topic.rb:-"], ary[7])
22
+ assert_parser(["Topic|Approved", "models/topic.rb:-"], ary[8])
23
+ assert_parser(["Topic|Replies count", "models/topic.rb:-"], ary[9])
24
+ assert_parser(["Topic|Parent", "models/topic.rb:-"], ary[10])
25
+ assert_parser(["Topic|Type", "models/topic.rb:-"], ary[11])
26
+ assert_parser(["Topic|Terms of service", "models/topic.rb:35"], ary[12])
27
+ assert_parser(["must be abided", "models/topic.rb:36"], ary[13])
31
28
  end
32
29
 
33
30
  def test_subclass
34
- GetText::ActiveRecordParser.target?("models/reply.rb")
35
- ary = GetText::ActiveRecordParser.parse("models/reply.rb")
31
+ ary = GetText::RGetText.parse("models/reply.rb")
36
32
  ary.sort!{|a, b| a[0].downcase <=> b[0].downcase}
37
33
 
38
34
  assert_equal(30, ary.size)
39
- assert_equal(["Empty", "models/reply.rb:16", "models/reply.rb:20"], ary[0])
40
- assert_equal(["is Content Mismatch", "models/reply.rb:25"], ary[1])
41
- assert_equal(["is Wrong Create", "models/reply.rb:30"], ary[2])
42
- assert_equal(["is Wrong Update", "models/reply.rb:34"], ary[3])
43
- assert_equal(["reply", "models/reply.rb:-"], ary[4])
44
- assert_equal(["Reply|Approved", "models/reply.rb:-"], ary[5])
45
- assert_equal(["Reply|Author email address", "models/reply.rb:-"], ary[6])
46
- assert_equal(["Reply|Author name", "models/reply.rb:-"], ary[7])
47
- assert_equal(["Reply|Bonus time", "models/reply.rb:-"], ary[8])
48
- assert_equal(["Reply|Content", "models/reply.rb:-"], ary[9])
49
- assert_equal(["Reply|Last read", "models/reply.rb:-"], ary[10])
50
- assert_equal(["Reply|Parent", "models/reply.rb:-"], ary[11])
51
- assert_equal(["Reply|Replies count", "models/reply.rb:-"], ary[12])
52
- assert_equal(["Reply|Title", "models/reply.rb:-"], ary[13])
35
+ assert_parser(["Empty", "models/reply.rb:16", "models/reply.rb:20"], ary[0])
36
+ assert_parser(["is Content Mismatch", "models/reply.rb:25"], ary[1])
37
+ assert_parser(["is Wrong Create", "models/reply.rb:30"], ary[2])
38
+ assert_parser(["is Wrong Update", "models/reply.rb:34"], ary[3])
39
+ assert_parser(["reply", "models/reply.rb:-"], ary[4])
40
+ assert_parser(["Reply|Approved", "models/reply.rb:-"], ary[5])
41
+ assert_parser(["Reply|Author email address", "models/reply.rb:-"], ary[6])
42
+ assert_parser(["Reply|Author name", "models/reply.rb:-"], ary[7])
43
+ assert_parser(["Reply|Bonus time", "models/reply.rb:-"], ary[8])
44
+ assert_parser(["Reply|Content", "models/reply.rb:-"], ary[9])
45
+ assert_parser(["Reply|Last read", "models/reply.rb:-"], ary[10])
46
+ assert_parser(["Reply|Parent", "models/reply.rb:-"], ary[11])
47
+ assert_parser(["Reply|Replies count", "models/reply.rb:-"], ary[12])
48
+ assert_parser(["Reply|Title", "models/reply.rb:-"], ary[13])
53
49
  # this target is from N_().
54
- assert_equal(["Reply|Topic", "models/reply.rb:4"], ary[14])
55
- assert_equal(["Reply|Type", "models/reply.rb:-"], ary[15])
56
- assert_equal(["Reply|Written on", "models/reply.rb:-"], ary[16])
50
+ assert_parser(["Reply|Topic", "models/reply.rb:4"], ary[14])
51
+ assert_parser(["Reply|Type", "models/reply.rb:-"], ary[15])
52
+ assert_parser(["Reply|Written on", "models/reply.rb:-"], ary[16])
57
53
 
58
- assert_equal(["sillyreply", "models/reply.rb:-"], ary[17])
59
- assert_equal(["SillyReply|Approved", "models/reply.rb:-"], ary[18])
60
- assert_equal(["SillyReply|Author email address", "models/reply.rb:-"], ary[19])
61
- assert_equal(["SillyReply|Author name", "models/reply.rb:-"], ary[20])
62
- assert_equal(["SillyReply|Bonus time", "models/reply.rb:-"], ary[21])
63
- assert_equal(["SillyReply|Content", "models/reply.rb:-"], ary[22])
64
- assert_equal(["SillyReply|Last read", "models/reply.rb:-"], ary[23])
65
- assert_equal(["SillyReply|Parent", "models/reply.rb:-"], ary[24])
66
- assert_equal(["SillyReply|Replies count", "models/reply.rb:-"], ary[25])
67
- assert_equal(["SillyReply|Title", "models/reply.rb:-"], ary[26])
68
- assert_equal(["SillyReply|Type", "models/reply.rb:-"], ary[27])
69
- assert_equal(["SillyReply|Written on", "models/reply.rb:-"], ary[28])
54
+ assert_parser(["sillyreply", "models/reply.rb:-"], ary[17])
55
+ assert_parser(["SillyReply|Approved", "models/reply.rb:-"], ary[18])
56
+ assert_parser(["SillyReply|Author email address", "models/reply.rb:-"], ary[19])
57
+ assert_parser(["SillyReply|Author name", "models/reply.rb:-"], ary[20])
58
+ assert_parser(["SillyReply|Bonus time", "models/reply.rb:-"], ary[21])
59
+ assert_parser(["SillyReply|Content", "models/reply.rb:-"], ary[22])
60
+ assert_parser(["SillyReply|Last read", "models/reply.rb:-"], ary[23])
61
+ assert_parser(["SillyReply|Parent", "models/reply.rb:-"], ary[24])
62
+ assert_parser(["SillyReply|Replies count", "models/reply.rb:-"], ary[25])
63
+ assert_parser(["SillyReply|Title", "models/reply.rb:-"], ary[26])
64
+ assert_parser(["SillyReply|Type", "models/reply.rb:-"], ary[27])
65
+ assert_parser(["SillyReply|Written on", "models/reply.rb:-"], ary[28])
70
66
 
71
- assert_equal(["topic", "models/reply.rb:-"], ary[29])
67
+ assert_parser(["topic", "models/reply.rb:-"], ary[29])
72
68
  end
73
69
 
74
70
  def test_untranslate
@@ -76,10 +72,10 @@ class TestGetTextParser < Test::Unit::TestCase
76
72
  ary = GetText::ActiveRecordParser.parse("models/book.rb")
77
73
  ary.sort!{|a, b| a[0].downcase <=> b[0].downcase}
78
74
  assert_equal(4, ary.size)
79
- assert_equal(["book", "models/book.rb:-"], ary[0])
80
- assert_equal(["Book|Created at", "models/book.rb:-"], ary[1])
81
- assert_equal(["Book|Price", "models/book.rb:-"], ary[2])
82
- assert_equal(["Book|Updated at", "models/book.rb:-"], ary[3])
75
+ assert_parser(["book", "models/book.rb:-"], ary[0])
76
+ assert_parser(["Book|Created at", "models/book.rb:-"], ary[1])
77
+ assert_parser(["Book|Price", "models/book.rb:-"], ary[2])
78
+ assert_parser(["Book|Updated at", "models/book.rb:-"], ary[3])
83
79
  end
84
80
 
85
81
  def test_untranslate_all
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masao Mutoh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-23 00:00:00 +09:00
12
+ date: 2009-11-14 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.0.4
23
+ version: 2.1.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
@@ -41,191 +41,100 @@ extensions: []
41
41
  extra_rdoc_files: []
42
42
 
43
43
  files:
44
- - po
45
- - po/es
46
- - po/es/gettext_activerecord.po
47
- - po/el
48
- - po/el/gettext_activerecord.po
49
- - po/cs
50
- - po/cs/gettext_activerecord.po
51
- - po/ko
52
- - po/ko/gettext_activerecord.po
53
- - po/sr
54
- - po/sr/gettext_activerecord.po
55
- - po/nb
56
- - po/nb/gettext_activerecord.po
57
- - po/zh
58
- - po/zh/gettext_activerecord.po
59
- - po/eo
60
- - po/eo/gettext_activerecord.po
61
- - po/vi
62
- - po/vi/gettext_activerecord.po
63
- - po/nl
64
- - po/nl/gettext_activerecord.po
65
- - po/fr
66
- - po/fr/gettext_activerecord.po
67
- - po/bg
68
- - po/bg/gettext_activerecord.po
69
- - po/hu
70
- - po/hu/gettext_activerecord.po
71
- - po/ua
72
- - po/ua/gettext_activerecord.po
73
- - po/hr
74
- - po/hr/gettext_activerecord.po
75
- - po/et
76
- - po/et/gettext_activerecord.po
77
- - po/lv
78
- - po/lv/gettext_activerecord.po
79
- - po/it
80
- - po/it/gettext_activerecord.po
81
- - po/pt_BR
82
- - po/pt_BR/gettext_activerecord.po
83
- - po/ja
84
- - po/ja/gettext_activerecord.po
85
- - po/zh_TW
86
- - po/zh_TW/gettext_activerecord.po
87
- - po/ru
88
- - po/ru/gettext_activerecord.po
89
- - po/bs
90
- - po/bs/gettext_activerecord.po
91
- - po/de
92
- - po/de/gettext_activerecord.po
93
- - po/gettext_activerecord.pot
94
- - po/ca
95
- - po/ca/gettext_activerecord.po
96
- - ChangeLog
97
- - COPYING
98
- - lib
99
- - lib/gettext_activerecord
100
- - lib/gettext_activerecord/tools.rb
101
44
  - lib/gettext_activerecord/base.rb
102
- - lib/gettext_activerecord/version.rb
103
- - lib/gettext_activerecord/migration.rb
104
- - lib/gettext_activerecord/parser.rb
45
+ - lib/gettext_activerecord/i18n.rb
105
46
  - lib/gettext_activerecord/schema_definitions.rb
106
47
  - lib/gettext_activerecord/validations.rb
107
- - lib/gettext_activerecord/i18n.rb
48
+ - lib/gettext_activerecord/migration.rb
49
+ - lib/gettext_activerecord/tools.rb
50
+ - lib/gettext_activerecord/version.rb
51
+ - lib/gettext_activerecord/parser.rb
108
52
  - lib/gettext_activerecord.rb
109
- - README.rdoc
110
- - test
111
- - test/test_parser.rb
112
- - test/po
113
- - test/po/ja
114
- - test/po/ja/active_record.po
115
- - test/po/active_record.pot
53
+ - test/Rakefile
116
54
  - test/helper.rb
117
- - test/locale
118
- - test/locale/ja
119
- - test/locale/ja/LC_MESSAGES
120
- - test/locale/ja/LC_MESSAGES/active_record.mo
121
- - test/test_validations.rb
122
- - test/db
123
- - test/db/sqlite.rb
55
+ - test/vendor/repair_helper.rb
56
+ - test/test_parser.rb
124
57
  - test/db/migrate.rb
125
- - test/models
58
+ - test/db/sqlite.rb
59
+ - test/locale/ja/LC_MESSAGES/active_record.mo
60
+ - test/models/reply.rb
126
61
  - test/models/user.rb
127
62
  - test/models/topic.rb
128
- - test/models/book.rb
129
- - test/models/wizard.rb
130
63
  - test/models/inept_wizard.rb
131
- - test/models/reply.rb
64
+ - test/models/wizard.rb
65
+ - test/models/book.rb
132
66
  - test/models/developer.rb
133
- - test/vendor
134
- - test/vendor/repair_helper.rb
135
- - test/Rakefile
136
- - sample
137
- - sample/po
138
- - sample/po/sample_ar.pot
139
- - sample/po/ja
140
- - sample/po/ja/sample_ar.po
141
- - sample/book.rb
142
- - sample/sample.rb
143
- - sample/db
144
- - sample/db/schema.rb
145
- - sample/README.rdoc
146
- - sample/config
147
- - sample/config/database.yml
148
- - sample/Rakefile
149
- - data
150
- - data/locale
151
- - data/locale/es
152
- - data/locale/es/LC_MESSAGES
153
- - data/locale/es/LC_MESSAGES/gettext_activerecord.mo
154
- - data/locale/el
155
- - data/locale/el/LC_MESSAGES
67
+ - test/test_validations.rb
68
+ - test/po/ja/active_record.po
69
+ - test/po/active_record.pot
70
+ - Rakefile
71
+ - README.rdoc
72
+ - gettext_activerecord.gemspec
73
+ - ChangeLog
74
+ - data/locale/ru/LC_MESSAGES/gettext_activerecord.mo
156
75
  - data/locale/el/LC_MESSAGES/gettext_activerecord.mo
157
- - data/locale/cs
158
- - data/locale/cs/LC_MESSAGES
159
- - data/locale/cs/LC_MESSAGES/gettext_activerecord.mo
160
- - data/locale/ko
161
- - data/locale/ko/LC_MESSAGES
162
76
  - data/locale/ko/LC_MESSAGES/gettext_activerecord.mo
163
- - data/locale/sr
164
- - data/locale/sr/LC_MESSAGES
77
+ - data/locale/ja/LC_MESSAGES/gettext_activerecord.mo
165
78
  - data/locale/sr/LC_MESSAGES/gettext_activerecord.mo
166
- - data/locale/nb
167
- - data/locale/nb/LC_MESSAGES
168
- - data/locale/nb/LC_MESSAGES/gettext_activerecord.mo
169
- - data/locale/zh
170
- - data/locale/zh/LC_MESSAGES
171
- - data/locale/zh/LC_MESSAGES/gettext_activerecord.mo
172
- - data/locale/eo
173
- - data/locale/eo/LC_MESSAGES
174
79
  - data/locale/eo/LC_MESSAGES/gettext_activerecord.mo
175
- - data/locale/vi
176
- - data/locale/vi/LC_MESSAGES
80
+ - data/locale/bs/LC_MESSAGES/gettext_activerecord.mo
81
+ - data/locale/zh/LC_MESSAGES/gettext_activerecord.mo
177
82
  - data/locale/vi/LC_MESSAGES/gettext_activerecord.mo
178
- - data/locale/nl
179
- - data/locale/nl/LC_MESSAGES
180
- - data/locale/nl/LC_MESSAGES/gettext_activerecord.mo
181
- - data/locale/fr
182
- - data/locale/fr/LC_MESSAGES
183
- - data/locale/fr/LC_MESSAGES/gettext_activerecord.mo
184
- - data/locale/bg
185
- - data/locale/bg/LC_MESSAGES
186
- - data/locale/bg/LC_MESSAGES/gettext_activerecord.mo
187
- - data/locale/hu
188
- - data/locale/hu/LC_MESSAGES
189
- - data/locale/hu/LC_MESSAGES/gettext_activerecord.mo
190
- - data/locale/ua
191
- - data/locale/ua/LC_MESSAGES
192
- - data/locale/ua/LC_MESSAGES/gettext_activerecord.mo
193
- - data/locale/hr
194
- - data/locale/hr/LC_MESSAGES
195
- - data/locale/hr/LC_MESSAGES/gettext_activerecord.mo
196
- - data/locale/et
197
- - data/locale/et/LC_MESSAGES
198
83
  - data/locale/et/LC_MESSAGES/gettext_activerecord.mo
199
- - data/locale/lv
200
- - data/locale/lv/LC_MESSAGES
201
- - data/locale/lv/LC_MESSAGES/gettext_activerecord.mo
202
- - data/locale/it
203
- - data/locale/it/LC_MESSAGES
204
84
  - data/locale/it/LC_MESSAGES/gettext_activerecord.mo
205
- - data/locale/pt_BR
206
- - data/locale/pt_BR/LC_MESSAGES
207
- - data/locale/pt_BR/LC_MESSAGES/gettext_activerecord.mo
208
- - data/locale/ja
209
- - data/locale/ja/LC_MESSAGES
210
- - data/locale/ja/LC_MESSAGES/gettext_activerecord.mo
211
- - data/locale/zh_TW
212
- - data/locale/zh_TW/LC_MESSAGES
213
85
  - data/locale/zh_TW/LC_MESSAGES/gettext_activerecord.mo
214
- - data/locale/ru
215
- - data/locale/ru/LC_MESSAGES
216
- - data/locale/ru/LC_MESSAGES/gettext_activerecord.mo
217
- - data/locale/bs
218
- - data/locale/bs/LC_MESSAGES
219
- - data/locale/bs/LC_MESSAGES/gettext_activerecord.mo
220
- - data/locale/de
221
- - data/locale/de/LC_MESSAGES
222
- - data/locale/de/LC_MESSAGES/gettext_activerecord.mo
223
- - data/locale/ca
224
- - data/locale/ca/LC_MESSAGES
86
+ - data/locale/nb/LC_MESSAGES/gettext_activerecord.mo
87
+ - data/locale/ua/LC_MESSAGES/gettext_activerecord.mo
88
+ - data/locale/es/LC_MESSAGES/gettext_activerecord.mo
89
+ - data/locale/pt_BR/LC_MESSAGES/gettext_activerecord.mo
90
+ - data/locale/hr/LC_MESSAGES/gettext_activerecord.mo
91
+ - data/locale/cs/LC_MESSAGES/gettext_activerecord.mo
225
92
  - data/locale/ca/LC_MESSAGES/gettext_activerecord.mo
226
- - Rakefile
93
+ - data/locale/hu/LC_MESSAGES/gettext_activerecord.mo
94
+ - data/locale/bg/LC_MESSAGES/gettext_activerecord.mo
95
+ - data/locale/lv/LC_MESSAGES/gettext_activerecord.mo
96
+ - data/locale/de/LC_MESSAGES/gettext_activerecord.mo
97
+ - data/locale/nl/LC_MESSAGES/gettext_activerecord.mo
98
+ - data/locale/fr/LC_MESSAGES/gettext_activerecord.mo
99
+ - COPYING
100
+ - sample/Rakefile
101
+ - sample/README.rdoc
102
+ - sample/sample.rb
103
+ - sample/book.rb
104
+ - sample/db/schema.rb
105
+ - sample/po/ja/sample_ar.po
106
+ - sample/po/sample_ar.pot
107
+ - sample/config/database.yml
108
+ - po/ru/gettext_activerecord.po
109
+ - po/el/gettext_activerecord.po
110
+ - po/ko/gettext_activerecord.po
111
+ - po/ja/gettext_activerecord.po
112
+ - po/sr/gettext_activerecord.po
113
+ - po/eo/gettext_activerecord.po
114
+ - po/bs/gettext_activerecord.po
115
+ - po/zh/gettext_activerecord.po
116
+ - po/vi/gettext_activerecord.po
117
+ - po/et/gettext_activerecord.po
118
+ - po/it/gettext_activerecord.po
119
+ - po/zh_TW/gettext_activerecord.po
120
+ - po/nb/gettext_activerecord.po
121
+ - po/ua/gettext_activerecord.po
122
+ - po/es/gettext_activerecord.po
123
+ - po/pt_BR/gettext_activerecord.po
124
+ - po/hr/gettext_activerecord.po
125
+ - po/cs/gettext_activerecord.po
126
+ - po/ca/gettext_activerecord.po
127
+ - po/hu/gettext_activerecord.po
128
+ - po/bg/gettext_activerecord.po
129
+ - po/lv/gettext_activerecord.po
130
+ - po/gettext_activerecord.pot
131
+ - po/de/gettext_activerecord.po
132
+ - po/nl/gettext_activerecord.po
133
+ - po/fr/gettext_activerecord.po
227
134
  has_rdoc: true
228
135
  homepage: http://gettext.rubyforge.org/
136
+ licenses: []
137
+
229
138
  post_install_message:
230
139
  rdoc_options: []
231
140
 
@@ -246,9 +155,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
155
  requirements: []
247
156
 
248
157
  rubyforge_project: gettext
249
- rubygems_version: 1.3.1
158
+ rubygems_version: 1.3.5
250
159
  signing_key:
251
- specification_version: 2
160
+ specification_version: 3
252
161
  summary: Localization support for ActiveRecord by Ruby-GetText-Package.
253
162
  test_files: []
254
163