gettext 2.3.9 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/README.rdoc +28 -23
- data/Rakefile +29 -21
- data/doc/text/news.md +57 -0
- data/gettext.gemspec +1 -1
- data/lib/gettext.rb +13 -29
- data/lib/gettext/cgi.rb +1 -1
- data/lib/gettext/{runtime/class_info.rb → class_info.rb} +1 -1
- data/lib/gettext/{runtime/locale_path.rb → locale_path.rb} +1 -2
- data/lib/gettext/{runtime/mo.rb → mo.rb} +18 -33
- data/lib/gettext/{tools/po.rb → po.rb} +1 -1
- data/lib/gettext/{tools/po_entry.rb → po_entry.rb} +8 -4
- data/lib/gettext/{tools/poparser.rb → po_parser.rb} +41 -44
- data/lib/gettext/{runtime/textdomain.rb → text_domain.rb} +6 -16
- data/lib/gettext/text_domain_group.rb +26 -0
- data/lib/gettext/{runtime/textdomain_manager.rb → text_domain_manager.rb} +40 -40
- data/lib/gettext/tools.rb +1 -182
- data/lib/gettext/tools/msgfmt.rb +1 -1
- data/lib/gettext/tools/msginit.rb +1 -1
- data/lib/gettext/tools/msgmerge.rb +2 -221
- data/lib/gettext/tools/parser/erb.rb +49 -30
- data/lib/gettext/tools/parser/glade.rb +44 -36
- data/lib/gettext/tools/parser/ruby.rb +126 -37
- data/lib/gettext/tools/task.rb +225 -0
- data/lib/gettext/tools/xgettext.rb +25 -28
- data/lib/gettext/version.rb +1 -1
- data/locale/bg/LC_MESSAGES/gettext.mo +0 -0
- data/locale/bs/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ca/LC_MESSAGES/gettext.mo +0 -0
- data/locale/cs/LC_MESSAGES/gettext.mo +0 -0
- data/locale/de/LC_MESSAGES/gettext.mo +0 -0
- data/locale/el/LC_MESSAGES/gettext.mo +0 -0
- data/locale/eo/LC_MESSAGES/gettext.mo +0 -0
- data/locale/es/LC_MESSAGES/gettext.mo +0 -0
- data/locale/et/LC_MESSAGES/gettext.mo +0 -0
- data/locale/fr/LC_MESSAGES/gettext.mo +0 -0
- data/locale/hr/LC_MESSAGES/gettext.mo +0 -0
- data/locale/hu/LC_MESSAGES/gettext.mo +0 -0
- data/locale/it/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ko/LC_MESSAGES/gettext.mo +0 -0
- data/locale/lv/LC_MESSAGES/gettext.mo +0 -0
- data/locale/nb/LC_MESSAGES/gettext.mo +0 -0
- data/locale/nl/LC_MESSAGES/gettext.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ru/LC_MESSAGES/gettext.mo +0 -0
- data/locale/sr/LC_MESSAGES/gettext.mo +0 -0
- data/locale/sv/LC_MESSAGES/gettext.mo +0 -0
- data/locale/uk/LC_MESSAGES/gettext.mo +0 -0
- data/locale/vi/LC_MESSAGES/gettext.mo +0 -0
- data/locale/zh/LC_MESSAGES/gettext.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/gettext.mo +0 -0
- data/po/gettext.pot +171 -97
- data/samples/hello.rb +3 -2
- data/samples/hello2.rb +2 -1
- data/samples/hello_gtk2.rb +4 -1
- data/samples/hello_gtk_builder.rb +32 -0
- data/samples/hello_gtk_builder.ui +46 -0
- data/samples/hello_noop.rb +2 -1
- data/samples/hello_plural.rb +2 -1
- data/samples/hello_tk.rb +2 -1
- data/src/{poparser.ry → po_parser.ry} +31 -35
- data/test/fixtures/N_.rb +1 -1
- data/test/fixtures/_/double_quote_in_double_quote.rb +32 -0
- data/test/fixtures/_/double_quote_in_single_quote.rb +32 -0
- data/test/fixtures/_/literal_concatenation_with_continuation_line.rb +36 -0
- data/test/fixtures/_/middle_new_line.rb +32 -0
- data/test/fixtures/_/multiple_lines_literal.rb +35 -0
- data/test/fixtures/_/multiple_messages_in_same_line.rb +32 -0
- data/test/fixtures/_/multiple_same_messages.rb +36 -0
- data/{lib/gettext/runtime/mofile.rb → test/fixtures/_/one_new_line.rb} +12 -6
- data/test/fixtures/{multi_textdomain.rb → multi_text_domain.rb} +1 -1
- data/test/fixtures/non_ascii.rb +1 -1
- data/test/fixtures/simple.rb +1 -1
- data/test/fixtures/untranslated.rb +1 -1
- data/test/gettext-test-utils.rb +1 -24
- data/test/po/ja/_.po +63 -13
- data/test/po/ja/non_ascii.po +2 -3
- data/test/po/ja/untranslated.po +1 -1
- data/test/test_class_info.rb +2 -2
- data/test/test_gettext.rb +11 -11
- data/test/test_mo.rb +2 -2
- data/test/test_parser.rb +93 -96
- data/test/test_po_entry.rb +237 -146
- data/test/test_po_parser.rb +107 -98
- data/test/test_string.rb +1 -1
- data/test/{test_textdomain_bind.rb → test_text_domain_bind.rb} +6 -6
- data/test/{test_textdomain_multi.rb → test_text_domain_multi.rb} +5 -5
- data/test/{test_textdomain_toplevel.rb → test_text_domain_toplevel.rb} +1 -1
- data/test/test_thread.rb +1 -1
- data/test/tools/files/simple_translation.rb +1 -1
- data/test/{parser → tools/parser}/test_ruby.rb +110 -14
- data/test/tools/test_msgmerge.rb +17 -276
- data/test/tools/test_po.rb +1 -1
- data/test/tools/test_xgettext.rb +175 -144
- metadata +59 -33
- data/lib/gettext/core_ext/iconv.rb +0 -110
- data/lib/gettext/core_ext/string.rb +0 -91
- data/lib/gettext/parser/erb.rb +0 -5
- data/lib/gettext/parser/glade.rb +0 -5
- data/lib/gettext/parser/ruby.rb +0 -172
- data/lib/gettext/runtime/textdomain_group.rb +0 -26
- data/lib/gettext/task.rb +0 -203
- data/lib/gettext/utils.rb +0 -39
- data/test/test_po_generation.rb +0 -45
- data/test/tools/test_tools.rb +0 -61
data/test/test_po_entry.rb
CHANGED
@@ -1,10 +1,27 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
|
+
# Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
|
5
|
+
# Copyright (C) 2010 masone (Christian Felder) <ema@rh-productions.ch>
|
6
|
+
# Copyright (C) 2009 Masao Mutoh
|
7
|
+
#
|
8
|
+
# License: Ruby's or LGPL
|
9
|
+
#
|
10
|
+
# This library is free software: you can redistribute it and/or modify
|
11
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
12
|
+
# the Free Software Foundation, either version 3 of the License, or
|
13
|
+
# (at your option) any later version.
|
14
|
+
#
|
15
|
+
# This library is distributed in the hope that it will be useful,
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
+
# GNU Lesser General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Lesser General Public License
|
21
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2
22
|
|
3
23
|
require 'gettext/tools/parser/ruby'
|
4
24
|
|
5
|
-
# Most functionality of PoMessage is thoroughly tested together
|
6
|
-
# with the parser and po file generator. Here only tests for some special
|
7
|
-
# functionality.
|
8
25
|
class TestPOEntry < Test::Unit::TestCase
|
9
26
|
|
10
27
|
def test_context_match
|
@@ -53,151 +70,219 @@ class TestPOEntry < Test::Unit::TestCase
|
|
53
70
|
end
|
54
71
|
|
55
72
|
class TestToS < self
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
73
|
+
class TestNormal < self
|
74
|
+
def setup
|
75
|
+
@entry = GetText::POEntry.new(:normal)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_minimum
|
79
|
+
@entry.msgid = 'hello'
|
80
|
+
@entry.references = ["file1:1", "file2:10"]
|
81
|
+
assert_equal(<<-PO, @entry.to_s)
|
82
|
+
#: file1:1 file2:10
|
83
|
+
msgid "hello"
|
84
|
+
msgstr ""
|
85
|
+
PO
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_with_garbage_information
|
89
|
+
@entry.msgid = 'hello'
|
90
|
+
@entry.references = ["file1:1", "file2:10"]
|
91
|
+
@entry.msgctxt = 'context'
|
92
|
+
@entry.msgid_plural = 'hello2'
|
93
|
+
assert_equal(<<-PO, @entry.to_s)
|
94
|
+
#: file1:1 file2:10
|
95
|
+
msgid "hello"
|
96
|
+
msgstr ""
|
97
|
+
PO
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_new_line
|
101
|
+
@entry.msgid = "hello\nworld"
|
102
|
+
assert_equal(<<-PO, @entry.to_s)
|
103
|
+
msgid ""
|
104
|
+
"hello\\n"
|
105
|
+
"world"
|
106
|
+
msgstr ""
|
107
|
+
PO
|
108
|
+
end
|
66
109
|
end
|
67
110
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
111
|
+
class TestPlural < self
|
112
|
+
def setup
|
113
|
+
@entry = GetText::POEntry.new(:plural)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_minimum
|
117
|
+
@entry.msgid = 'hello'
|
118
|
+
@entry.msgid_plural = 'hello2'
|
119
|
+
@entry.references = ["file1:1", "file2:10"]
|
120
|
+
assert_equal(<<-PO, @entry.to_s)
|
121
|
+
#: file1:1 file2:10
|
122
|
+
msgid "hello"
|
123
|
+
msgid_plural "hello2"
|
124
|
+
msgstr[0] ""
|
125
|
+
msgstr[1] ""
|
126
|
+
PO
|
127
|
+
end
|
74
128
|
|
75
|
-
|
76
|
-
|
77
|
-
|
129
|
+
def test_with_garbage_information
|
130
|
+
@entry.msgid = 'hello'
|
131
|
+
@entry.msgid_plural = 'hello2'
|
132
|
+
@entry.references = ["file1:1", "file2:10"]
|
133
|
+
@entry.msgctxt = 'context'
|
134
|
+
assert_equal(<<-PO, @entry.to_s)
|
135
|
+
#: file1:1 file2:10
|
136
|
+
msgid "hello"
|
137
|
+
msgid_plural "hello2"
|
138
|
+
msgstr[0] ""
|
139
|
+
msgstr[1] ""
|
140
|
+
PO
|
141
|
+
end
|
78
142
|
end
|
79
143
|
|
80
144
|
def test_msgctxt
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
assert_equal
|
145
|
+
entry = GetText::POEntry.new(:msgctxt)
|
146
|
+
entry.msgctxt = 'context'
|
147
|
+
entry.msgid = 'hello'
|
148
|
+
entry.references = ["file1:1", "file2:10"]
|
149
|
+
assert_equal(<<-PO, entry.to_s)
|
150
|
+
#: file1:1 file2:10
|
151
|
+
msgctxt "context"
|
152
|
+
msgid "hello"
|
153
|
+
msgstr ""
|
154
|
+
PO
|
86
155
|
end
|
87
156
|
|
88
157
|
def test_msgctxt_plural
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
assert_equal
|
158
|
+
entry = GetText::POEntry.new(:msgctxt_plural)
|
159
|
+
entry.msgctxt = 'context'
|
160
|
+
entry.msgid = 'hello'
|
161
|
+
entry.msgid_plural = 'hello2'
|
162
|
+
entry.references = ["file1:1", "file2:10"]
|
163
|
+
assert_equal(<<-PO, entry.to_s)
|
164
|
+
#: file1:1 file2:10
|
165
|
+
msgctxt "context"
|
166
|
+
msgid "hello"
|
167
|
+
msgid_plural "hello2"
|
168
|
+
msgstr[0] ""
|
169
|
+
msgstr[1] ""
|
170
|
+
PO
|
95
171
|
end
|
96
172
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
173
|
+
class TestInvalid < self
|
174
|
+
def test_normal
|
175
|
+
entry = GetText::POEntry.new(:normal)
|
176
|
+
entry.references = ["file1:1", "file2:10"]
|
177
|
+
assert_raise(GetText::POEntry::NoMsgidError) {entry.to_s}
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_plural
|
181
|
+
entry = GetText::POEntry.new(:plural)
|
182
|
+
entry.msgid = 'hello'
|
183
|
+
entry.references = ["file1:1", "file2:10"]
|
184
|
+
assert_raise(GetText::POEntry::NoMsgidPluralError) {entry.to_s}
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_msgctxt
|
188
|
+
entry = GetText::POEntry.new(:msgctxt)
|
189
|
+
entry.msgid = 'hello'
|
190
|
+
entry.references = ["file1:1", "file2:10"]
|
191
|
+
assert_raise(GetText::POEntry::NoMsgctxtError) {entry.to_s}
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_msgctx_plural
|
195
|
+
entry = GetText::POEntry.new(:msgctxt_plural)
|
196
|
+
entry.msgctxt = 'context'
|
197
|
+
entry.msgid = 'hello'
|
198
|
+
entry.references = ["file1:1", "file2:10"]
|
199
|
+
assert_raise(GetText::POEntry::NoMsgidPluralError) {entry.to_s}
|
200
|
+
end
|
120
201
|
end
|
121
202
|
|
122
203
|
def test_header
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
expected_header =
|
204
|
+
entry = GetText::POEntry.new(:normal)
|
205
|
+
entry.msgid = ""
|
206
|
+
entry.msgstr = "This is the header entry."
|
207
|
+
entry.references = nil
|
208
|
+
expected_header = <<-EOH
|
128
209
|
msgid ""
|
129
210
|
msgstr "This is the header entry."
|
130
211
|
EOH
|
131
|
-
assert_equal(expected_header,
|
212
|
+
assert_equal(expected_header, entry.to_s)
|
132
213
|
end
|
133
214
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
215
|
+
class TestMessageString < self
|
216
|
+
def test_normal
|
217
|
+
entry = GetText::POEntry.new(:normal)
|
218
|
+
entry.msgid = "hello"
|
219
|
+
entry.msgstr = "Bonjour"
|
220
|
+
entry.references = ["file1:1", "file2:10"]
|
221
|
+
expected_po = <<-EOE
|
140
222
|
#: file1:1 file2:10
|
141
223
|
msgid "hello"
|
142
224
|
msgstr "Bonjour"
|
143
225
|
EOE
|
144
|
-
|
145
|
-
|
226
|
+
assert_equal(expected_po, entry.to_s)
|
227
|
+
end
|
146
228
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
229
|
+
def test_plural
|
230
|
+
entry = GetText::POEntry.new(:plural)
|
231
|
+
entry.msgid = "he"
|
232
|
+
entry.msgid_plural = "them"
|
233
|
+
entry.msgstr = "il\000ils"
|
234
|
+
entry.references = ["file1:1", "file2:10"]
|
235
|
+
expected_po = <<-EOE
|
153
236
|
#: file1:1 file2:10
|
154
|
-
msgid "
|
155
|
-
|
237
|
+
msgid "he"
|
238
|
+
msgid_plural "them"
|
239
|
+
msgstr[0] "il"
|
240
|
+
msgstr[1] "ils"
|
156
241
|
EOE
|
157
|
-
|
158
|
-
|
242
|
+
assert_equal(expected_po, entry.to_s)
|
243
|
+
end
|
159
244
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
245
|
+
class TestEscape < self
|
246
|
+
def test_normal
|
247
|
+
entry = GetText::POEntry.new(:normal)
|
248
|
+
entry.msgid = "He said \"hello.\""
|
249
|
+
entry.msgstr = "Il a dit \"bonjour.\""
|
250
|
+
entry.references = ["file1:1", "file2:10"]
|
251
|
+
expected_po = <<-EOE
|
167
252
|
#: file1:1 file2:10
|
168
|
-
msgid "He said
|
169
|
-
|
170
|
-
msgstr[0] "Il a dit \\\"bonjour.\\\""
|
171
|
-
msgstr[1] "Ils ont dit \\\"bonjour.\\\""
|
253
|
+
msgid "He said \\"hello.\\""
|
254
|
+
msgstr "Il a dit \\"bonjour.\\""
|
172
255
|
EOE
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
256
|
+
assert_equal(expected_po, entry.to_s)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_plural
|
260
|
+
entry = GetText::POEntry.new(:plural)
|
261
|
+
entry.msgid = "He said \"hello.\""
|
262
|
+
entry.msgid_plural = "They said \"hello.\""
|
263
|
+
entry.msgstr = "Il a dit \"bonjour.\"\000Ils ont dit \"bonjour.\""
|
264
|
+
entry.references = ["file1:1", "file2:10"]
|
265
|
+
expected_po = <<-EOE
|
183
266
|
#: file1:1 file2:10
|
184
|
-
msgid "
|
185
|
-
msgid_plural "
|
186
|
-
msgstr[0] "
|
187
|
-
msgstr[1] "
|
267
|
+
msgid "He said \\"hello.\\""
|
268
|
+
msgid_plural "They said \\"hello.\\""
|
269
|
+
msgstr[0] "Il a dit \\"bonjour.\\""
|
270
|
+
msgstr[1] "Ils ont dit \\"bonjour.\\""
|
188
271
|
EOE
|
189
|
-
|
272
|
+
assert_equal(expected_po, entry.to_s)
|
273
|
+
end
|
274
|
+
end
|
190
275
|
end
|
191
276
|
|
192
277
|
def test_obsolete_comment
|
193
|
-
|
194
|
-
|
195
|
-
obsolete_comment
|
278
|
+
entry = GetText::POEntry.new(:normal)
|
279
|
+
entry.msgid = :last
|
280
|
+
obsolete_comment = <<-EOC
|
196
281
|
# test.rb:10
|
197
|
-
msgid
|
198
|
-
msgstr
|
282
|
+
msgid "hello"
|
283
|
+
msgstr "Salut"
|
199
284
|
EOC
|
200
|
-
|
285
|
+
entry.comment = obsolete_comment
|
201
286
|
|
202
287
|
expected_obsolete_comment = <<-EOC
|
203
288
|
# test.rb:10
|
@@ -205,69 +290,69 @@ EOC
|
|
205
290
|
#~ msgstr "Salut"
|
206
291
|
EOC
|
207
292
|
|
208
|
-
assert_equal(expected_obsolete_comment,
|
293
|
+
assert_equal(expected_obsolete_comment, entry.to_s)
|
209
294
|
end
|
210
295
|
|
211
296
|
def test_translator_comment
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
297
|
+
entry = GetText::POEntry.new(:normal)
|
298
|
+
entry.msgid = "msgid"
|
299
|
+
entry.msgstr = "msgstr"
|
300
|
+
entry.translator_comment = "It's the translator comment."
|
216
301
|
|
217
|
-
expected_po
|
302
|
+
expected_po = <<-EOP
|
218
303
|
# It's the translator comment.
|
219
|
-
msgid
|
220
|
-
msgstr
|
304
|
+
msgid "msgid"
|
305
|
+
msgstr "msgstr"
|
221
306
|
EOP
|
222
|
-
assert_equal(expected_po,
|
307
|
+
assert_equal(expected_po, entry.to_s)
|
223
308
|
end
|
224
309
|
|
225
310
|
def test_extracted_comment
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
311
|
+
entry = GetText::POEntry.new(:normal)
|
312
|
+
entry.msgid = "msgid"
|
313
|
+
entry.msgstr = "msgstr"
|
314
|
+
entry.extracted_comment = "It's the extracted comment."
|
230
315
|
|
231
|
-
expected_po
|
316
|
+
expected_po = <<-EOP
|
232
317
|
#. It's the extracted comment.
|
233
|
-
msgid
|
234
|
-
msgstr
|
318
|
+
msgid "msgid"
|
319
|
+
msgstr "msgstr"
|
235
320
|
EOP
|
236
|
-
assert_equal(expected_po,
|
321
|
+
assert_equal(expected_po, entry.to_s)
|
237
322
|
end
|
238
323
|
|
239
324
|
def test_flag
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
325
|
+
entry = GetText::POEntry.new(:normal)
|
326
|
+
entry.msgid = "msgid"
|
327
|
+
entry.msgstr = "msgstr"
|
328
|
+
entry.flag = "It's the flag."
|
244
329
|
|
245
|
-
expected_po
|
330
|
+
expected_po = <<-EOP
|
246
331
|
#, It's the flag.
|
247
|
-
msgid
|
248
|
-
msgstr
|
332
|
+
msgid "msgid"
|
333
|
+
msgstr "msgstr"
|
249
334
|
EOP
|
250
|
-
assert_equal(expected_po,
|
335
|
+
assert_equal(expected_po, entry.to_s)
|
251
336
|
end
|
252
337
|
|
253
338
|
def test_previous
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
339
|
+
entry = GetText::POEntry.new(:normal)
|
340
|
+
entry.msgid = "msgid"
|
341
|
+
entry.msgstr = "msgstr"
|
342
|
+
entry.previous = <<-EOC
|
258
343
|
msgctxt previous_msgctxt
|
259
344
|
msgid previous_msgid
|
260
345
|
msgid_plural previous_msgid_plural
|
261
346
|
EOC
|
262
347
|
|
263
|
-
expected_po
|
348
|
+
expected_po = <<-EOP
|
264
349
|
#| msgctxt previous_msgctxt
|
265
350
|
#| msgid previous_msgid
|
266
351
|
#| msgid_plural previous_msgid_plural
|
267
|
-
msgid
|
268
|
-
msgstr
|
352
|
+
msgid "msgid"
|
353
|
+
msgstr "msgstr"
|
269
354
|
EOP
|
270
|
-
assert_equal(expected_po,
|
355
|
+
assert_equal(expected_po, entry.to_s)
|
271
356
|
end
|
272
357
|
end
|
273
358
|
|
@@ -287,6 +372,12 @@ EOP
|
|
287
372
|
assert_equal("First\\nSecond\\nThird",
|
288
373
|
@entry.escaped(:msgid))
|
289
374
|
end
|
375
|
+
|
376
|
+
def test_tab
|
377
|
+
@entry.msgid = "First\tSecond\tThird"
|
378
|
+
assert_equal("First\\tSecond\\tThird",
|
379
|
+
@entry.escaped(:msgid))
|
380
|
+
end
|
290
381
|
end
|
291
382
|
|
292
383
|
class TestFormatMessage < self
|