gettext 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  #
6
6
  # License: Ruby's or LGPL
7
7
  #
@@ -178,7 +178,9 @@ module GetText
178
178
 
179
179
  pot[""] = @entry
180
180
  pot[""].translator_comment = @comment
181
- pot[""].flag = pot[""].flag.gsub(/\Afuzzy\z/, "")
181
+ pot[""].flags = pot[""].flags.reject do |flag|
182
+ flag == "fuzzy"
183
+ end
182
184
  pot
183
185
  end
184
186
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2012-2013 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  # Copyright (C) 2005-2009 Masao Mutoh
6
6
  # Copyright (C) 2005,2006 speakillof
7
7
  #
@@ -133,14 +133,14 @@ module GetText
133
133
  return merge_header(reference_entry, definition_entry)
134
134
  end
135
135
 
136
- return definition_entry if definition_entry.flag == "fuzzy"
136
+ return definition_entry if definition_entry.fuzzy?
137
137
 
138
138
  entry = reference_entry
139
139
  entry.translator_comment = definition_entry.translator_comment
140
140
  entry.previous = nil
141
141
 
142
142
  unless definition_entry.msgid_plural == reference_entry.msgid_plural
143
- entry.flag = "fuzzy"
143
+ entry.flags << "fuzzy"
144
144
  end
145
145
 
146
146
  entry.msgstr = definition_entry.msgstr
@@ -154,7 +154,7 @@ module GetText
154
154
  pot_creation_date = "POT-Creation-Date: #{create_date}"
155
155
  header.msgstr = header.msgstr.gsub(POT_DATE_RE, pot_creation_date)
156
156
  end
157
- header.flag = nil
157
+ header.flags = []
158
158
  header
159
159
  end
160
160
 
@@ -170,7 +170,7 @@ module GetText
170
170
 
171
171
  def merge_fuzzy_entry(entry, fuzzy_entry)
172
172
  merged_entry = merge_entry(entry, fuzzy_entry)
173
- merged_entry.flag = "fuzzy"
173
+ merged_entry.flags << "fuzzy"
174
174
  merged_entry
175
175
  end
176
176
 
@@ -272,7 +272,7 @@ module GetText
272
272
  @reference_po = nil
273
273
  @update = false
274
274
  @output = nil
275
- @order = :references
275
+ @order = :reference
276
276
  @po_format_options = {
277
277
  :max_line_width => POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH,
278
278
  }
@@ -329,18 +329,27 @@ module GetText
329
329
  end
330
330
 
331
331
  parser.on("--[no-]sort-output",
332
- _("Generate sorted output")) do |sort|
333
- @order = sort ? :references : nil
332
+ _("Sort output by msgid"),
333
+ _("It is same as --sort-by-msgid"),
334
+ _("Just for GNU gettext's msgcat compatibility")) do |sort|
335
+ @order = sort ? :msgid : nil
334
336
  end
335
337
 
336
- parser.on("--[no-]sort-by-file",
337
- _("Sort output by file location")) do |sort_by_file|
338
- @order = sort_by_file ? :references : :msgid
338
+ parser.on("--sort-by-file",
339
+ _("Sort output by location"),
340
+ _("It is same as --sort-by-location"),
341
+ _("Just for GNU gettext's msgcat compatibility")) do
342
+ @order = :reference
339
343
  end
340
344
 
341
- parser.on("--[no-]sort-by-msgid",
342
- _("Sort output by msgid")) do |sort_by_msgid|
343
- @order = sort_by_msgid ? :msgid : :references
345
+ parser.on("--sort-by-location",
346
+ _("Sort output by location")) do
347
+ @order = :reference
348
+ end
349
+
350
+ parser.on("--sort-by-msgid",
351
+ _("Sort output by msgid")) do
352
+ @order = :msgid
344
353
  end
345
354
 
346
355
  parser.on("--[no-]location",
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  # Copyright (C) 2003-2010 Masao Mutoh
6
6
  # Copyright (C) 2001,2002 Yasushi Shoji, Masao Mutoh
7
7
  #
@@ -212,7 +212,7 @@ Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;
212
212
  header.msgid = ""
213
213
  header.msgstr = header_content
214
214
  header.translator_comment = header_comment
215
- header.flag = "fuzzy"
215
+ header.flags << "fuzzy"
216
216
 
217
217
  po = parse(paths)
218
218
  po.order = @po_order
@@ -9,5 +9,5 @@
9
9
  =end
10
10
 
11
11
  module GetText
12
- VERSION = "3.0.3"
12
+ VERSION = "3.0.4"
13
13
  end
data/po/gettext.pot CHANGED
@@ -6,10 +6,10 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: gettext 3.0.3\n"
9
+ "Project-Id-Version: gettext 3.0.4\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2013-12-15 16:24+0900\n"
12
- "PO-Revision-Date: 2013-12-15 16:24+0900\n"
11
+ "POT-Creation-Date: 2014-02-02 22:41+0900\n"
12
+ "PO-Revision-Date: 2014-02-02 22:41+0900\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
@@ -26,6 +26,80 @@ msgstr ""
26
26
  msgid "ngettext: 3rd parameter should be a number, not nil."
27
27
  msgstr ""
28
28
 
29
+ #: ../lib/gettext/tools/msgcat.rb:168
30
+ msgid "Usage: %s [OPTIONS] PO_FILE1 PO_FILE2 ..."
31
+ msgstr ""
32
+
33
+ #: ../lib/gettext/tools/msgcat.rb:170
34
+ msgid "Concatenates and merges PO files."
35
+ msgstr ""
36
+
37
+ #: ../lib/gettext/tools/msgcat.rb:172 ../lib/gettext/tools/msgfmt.rb:86
38
+ #: ../lib/gettext/tools/msginit.rb:89 ../lib/gettext/tools/msgmerge.rb:319
39
+ #: ../lib/gettext/tools/xgettext.rb:248
40
+ msgid "Specific options:"
41
+ msgstr ""
42
+
43
+ #: ../lib/gettext/tools/msgcat.rb:175 ../lib/gettext/tools/msgmerge.rb:327
44
+ msgid "Write output to specified file"
45
+ msgstr ""
46
+
47
+ #: ../lib/gettext/tools/msgcat.rb:176
48
+ msgid "(default: the standard output)"
49
+ msgstr ""
50
+
51
+ #: ../lib/gettext/tools/msgcat.rb:181 ../lib/gettext/tools/msgcat.rb:198
52
+ #: ../lib/gettext/tools/msgmerge.rb:332 ../lib/gettext/tools/msgmerge.rb:351
53
+ #: ../lib/gettext/tools/xgettext.rb:302
54
+ msgid "Sort output by msgid"
55
+ msgstr ""
56
+
57
+ #: ../lib/gettext/tools/msgcat.rb:186 ../lib/gettext/tools/msgcat.rb:191
58
+ #: ../lib/gettext/tools/msgmerge.rb:339 ../lib/gettext/tools/msgmerge.rb:346
59
+ msgid "Sort output by location"
60
+ msgstr ""
61
+
62
+ #: ../lib/gettext/tools/msgcat.rb:192 ../lib/gettext/tools/msgmerge.rb:340
63
+ msgid "It is same as --sort-by-location"
64
+ msgstr ""
65
+
66
+ #: ../lib/gettext/tools/msgcat.rb:193 ../lib/gettext/tools/msgcat.rb:200
67
+ #: ../lib/gettext/tools/msgmerge.rb:334 ../lib/gettext/tools/msgmerge.rb:341
68
+ msgid "Just for GNU gettext's msgcat compatibility"
69
+ msgstr ""
70
+
71
+ #: ../lib/gettext/tools/msgcat.rb:199 ../lib/gettext/tools/msgmerge.rb:333
72
+ msgid "It is same as --sort-by-msgid"
73
+ msgstr ""
74
+
75
+ #: ../lib/gettext/tools/msgcat.rb:205
76
+ msgid "Remove location information"
77
+ msgstr ""
78
+
79
+ #: ../lib/gettext/tools/msgcat.rb:210
80
+ msgid "Remove all comments"
81
+ msgstr ""
82
+
83
+ #: ../lib/gettext/tools/msgcat.rb:215 ../lib/gettext/tools/msgmerge.rb:361
84
+ #: ../lib/gettext/tools/xgettext.rb:312
85
+ msgid "Set output page width"
86
+ msgstr ""
87
+
88
+ #: ../lib/gettext/tools/msgcat.rb:221 ../lib/gettext/tools/msgmerge.rb:367
89
+ #: ../lib/gettext/tools/xgettext.rb:318
90
+ msgid ""
91
+ "Break long message lines, longer than the output page width, into several line"
92
+ "s"
93
+ msgstr ""
94
+
95
+ #: ../lib/gettext/tools/msgcat.rb:232
96
+ msgid "Ignore fuzzy entries"
97
+ msgstr ""
98
+
99
+ #: ../lib/gettext/tools/msgcat.rb:237
100
+ msgid "Don't report warning messages"
101
+ msgstr ""
102
+
29
103
  #: ../lib/gettext/tools/msgfmt.rb:65
30
104
  msgid "no input files specified."
31
105
  msgstr ""
@@ -38,11 +112,6 @@ msgstr ""
38
112
  msgid "Generate binary message catalog from textual translation description."
39
113
  msgstr ""
40
114
 
41
- #: ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:89
42
- #: ../lib/gettext/tools/msgmerge.rb:319 ../lib/gettext/tools/xgettext.rb:248
43
- msgid "Specific options:"
44
- msgstr ""
45
-
46
115
  #: ../lib/gettext/tools/msgfmt.rb:89 ../lib/gettext/tools/xgettext.rb:251
47
116
  msgid "write output to specified file"
48
117
  msgstr ""
@@ -75,7 +144,7 @@ msgid ""
75
144
  " locale on your environment."
76
145
  msgstr ""
77
146
 
78
- #: ../lib/gettext/tools/msginit.rb:112 ../lib/gettext/tools/msgmerge.rb:374
147
+ #: ../lib/gettext/tools/msginit.rb:112 ../lib/gettext/tools/msgmerge.rb:383
79
148
  msgid "Display this help and exit"
80
149
  msgstr ""
81
150
 
@@ -101,11 +170,11 @@ msgstr ""
101
170
  msgid "file '%s' has already existed."
102
171
  msgstr ""
103
172
 
104
- #: ../lib/gettext/tools/msginit.rb:200
173
+ #: ../lib/gettext/tools/msginit.rb:202
105
174
  msgid "Please enter your full name"
106
175
  msgstr ""
107
176
 
108
- #: ../lib/gettext/tools/msginit.rb:229
177
+ #: ../lib/gettext/tools/msginit.rb:231
109
178
  msgid "Please enter your email address"
110
179
  msgstr ""
111
180
 
@@ -125,45 +194,19 @@ msgstr ""
125
194
  msgid "Update definition.po"
126
195
  msgstr ""
127
196
 
128
- #: ../lib/gettext/tools/msgmerge.rb:327
129
- msgid "Write output to specified file"
130
- msgstr ""
131
-
132
- #: ../lib/gettext/tools/msgmerge.rb:332 ../lib/gettext/tools/xgettext.rb:292
133
- msgid "Generate sorted output"
134
- msgstr ""
135
-
136
- #: ../lib/gettext/tools/msgmerge.rb:337 ../lib/gettext/tools/xgettext.rb:297
137
- msgid "Sort output by file location"
138
- msgstr ""
139
-
140
- #: ../lib/gettext/tools/msgmerge.rb:342 ../lib/gettext/tools/xgettext.rb:302
141
- msgid "Sort output by msgid"
142
- msgstr ""
143
-
144
- #: ../lib/gettext/tools/msgmerge.rb:347 ../lib/gettext/tools/xgettext.rb:307
197
+ #: ../lib/gettext/tools/msgmerge.rb:356 ../lib/gettext/tools/xgettext.rb:307
145
198
  msgid "Preserve '#: FILENAME:LINE' lines"
146
199
  msgstr ""
147
200
 
148
- #: ../lib/gettext/tools/msgmerge.rb:352 ../lib/gettext/tools/xgettext.rb:312
149
- msgid "Set output page width"
150
- msgstr ""
151
-
152
- #: ../lib/gettext/tools/msgmerge.rb:358 ../lib/gettext/tools/xgettext.rb:318
153
- msgid ""
154
- "Break long message lines, longer than the output page width, into several line"
155
- "s"
156
- msgstr ""
157
-
158
- #: ../lib/gettext/tools/msgmerge.rb:369
201
+ #: ../lib/gettext/tools/msgmerge.rb:378
159
202
  msgid "Disable fuzzy matching"
160
203
  msgstr ""
161
204
 
162
- #: ../lib/gettext/tools/msgmerge.rb:370
205
+ #: ../lib/gettext/tools/msgmerge.rb:379
163
206
  msgid "(enable)"
164
207
  msgstr ""
165
208
 
166
- #: ../lib/gettext/tools/msgmerge.rb:380
209
+ #: ../lib/gettext/tools/msgmerge.rb:389
167
210
  msgid "Display version information and exit"
168
211
  msgstr ""
169
212
 
@@ -215,6 +258,14 @@ msgstr ""
215
258
  msgid "set encoding for output"
216
259
  msgstr ""
217
260
 
261
+ #: ../lib/gettext/tools/xgettext.rb:292
262
+ msgid "Generate sorted output"
263
+ msgstr ""
264
+
265
+ #: ../lib/gettext/tools/xgettext.rb:297
266
+ msgid "Sort output by file location"
267
+ msgstr ""
268
+
218
269
  #: ../lib/gettext/tools/xgettext.rb:329
219
270
  msgid "require the library before executing xgettext"
220
271
  msgstr ""
@@ -232,11 +283,11 @@ msgid ""
232
283
  msgstr ""
233
284
 
234
285
  #: ../lib/gettext/tools/xgettext.rb:336
235
- msgid "(default: %s)"
286
+ msgid "no TAG"
236
287
  msgstr ""
237
288
 
238
289
  #: ../lib/gettext/tools/xgettext.rb:336
239
- msgid "no TAG"
290
+ msgid "(default: %s)"
240
291
  msgstr ""
241
292
 
242
293
  #: ../lib/gettext/tools/xgettext.rb:340
@@ -258,19 +309,22 @@ msgid "This message is from hellolib."
258
309
  msgstr ""
259
310
 
260
311
  #: ../samples/hello.rb:17
261
- msgid "Hello World\n"
312
+ msgid ""
313
+ "Hello World\n"
262
314
  msgstr ""
263
315
 
264
316
  #: ../samples/hello2.rb:19
265
- msgid "One is %{num}\n"
317
+ msgid ""
318
+ "One is %{num}\n"
266
319
  msgstr ""
267
320
 
268
321
  #: ../samples/hello2.rb:20
269
- msgid "Hello %{world}\n"
322
+ msgid "World"
270
323
  msgstr ""
271
324
 
272
325
  #: ../samples/hello2.rb:20
273
- msgid "World"
326
+ msgid ""
327
+ "Hello %{world}\n"
274
328
  msgstr ""
275
329
 
276
330
  #: ../samples/hello_glade2.glade:9 ../test/fixtures/gladeparser.glade:8
@@ -290,16 +344,18 @@ msgid "hello, gtk world"
290
344
  msgstr ""
291
345
 
292
346
  #: ../samples/hello_noop.rb:13
293
- msgid "Hello World"
347
+ msgid "Hello World2"
294
348
  msgstr ""
295
349
 
296
350
  #: ../samples/hello_noop.rb:13
297
- msgid "Hello World2"
351
+ msgid "Hello World"
298
352
  msgstr ""
299
353
 
300
354
  #: ../samples/hello_plural.rb:20
301
- msgid "There is an apple.\n"
302
- msgid_plural "There are %{num} apples.\n"
355
+ msgid ""
356
+ "There is an apple.\n"
357
+ msgid_plural ""
358
+ "There are %{num} apples.\n"
303
359
  msgstr[0] ""
304
360
  msgstr[1] ""
305
361
 
@@ -315,7 +371,8 @@ msgstr[0] ""
315
371
  msgstr[1] ""
316
372
 
317
373
  #: ../test/fixtures/N_.rb:14 ../test/fixtures/_.rb:34
318
- msgid "aaa\n"
374
+ msgid ""
375
+ "aaa\n"
319
376
  msgstr ""
320
377
 
321
378
  #: ../test/fixtures/N_.rb:18 ../test/fixtures/_.rb:38
@@ -458,7 +515,8 @@ msgid "one line"
458
515
  msgstr ""
459
516
 
460
517
  #: ../test/fixtures/_/one_new_line.rb:28
461
- msgid "one new line\n"
518
+ msgid ""
519
+ "one new line\n"
462
520
  msgstr ""
463
521
 
464
522
  #: ../test/fixtures/backslash.rb:27
@@ -529,7 +587,8 @@ msgid "no data"
529
587
  msgstr ""
530
588
 
531
589
  #: ../test/fixtures/n_.rb:33
532
- msgid "bbb\n"
590
+ msgid ""
591
+ "bbb\n"
533
592
  msgid_plural ""
534
593
  "ccc2\n"
535
594
  "ccc2"
data/src/po_parser.ry CHANGED
@@ -3,7 +3,7 @@
3
3
  # po_parser.ry - ruby version of msgfmt
4
4
  #
5
5
  # Copyright (C) 2002-2008 Masao Mutoh <mutomasa at gmail.com>
6
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
6
+ # Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
7
7
  # Copyright (C) 2012-2013 Haruka Yoshihara <yoshihara@clear-code.com>
8
8
  #
9
9
  # You may redistribute it and/or modify it under the same
@@ -162,7 +162,7 @@ require "gettext/po"
162
162
  @translator_comments = []
163
163
  @extracted_comments = []
164
164
  @references = []
165
- @flag = []
165
+ @flags = []
166
166
  @previous = []
167
167
  @comments = []
168
168
  @data = data
@@ -237,7 +237,7 @@ require "gettext/po"
237
237
  entry = POEntry.new(type)
238
238
  entry.translator_comment = format_comment(@translator_comments)
239
239
  entry.extracted_comment = format_comment(@extracted_comments)
240
- entry.flag = format_comment(@flag)
240
+ entry.flags = @flags
241
241
  entry.previous = format_comment(@previous)
242
242
  entry.references = @references
243
243
  entry.msgctxt = @msgctxt
@@ -257,7 +257,7 @@ require "gettext/po"
257
257
  @translator_comments = []
258
258
  @extracted_comments = []
259
259
  @references = []
260
- @flag = []
260
+ @flags = []
261
261
  @previous = []
262
262
  @references = []
263
263
  @comments.clear
@@ -289,7 +289,7 @@ require "gettext/po"
289
289
  when POFormat::REFERENCE_COMMENT_MARK
290
290
  @references.concat(parse_references_line(content))
291
291
  when POFormat::FLAG_MARK
292
- @flag << content
292
+ @flags.concat(parse_flags_line(content))
293
293
  when POFormat::PREVIOUS_COMMENT_MARK
294
294
  @previous << content
295
295
  else
@@ -356,5 +356,9 @@ require "gettext/po"
356
356
  def parse_references_line(line)
357
357
  line.split(/\s+/)
358
358
  end
359
+
360
+ def parse_flags_line(line)
361
+ line.split(/\s+/)
362
+ end
359
363
  ---- footer
360
364