gettext 3.4.6 → 3.4.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 623479874c1f5d1800b18fc285df714bdb8bc48b63f55547e634506ac89a5b4f
4
- data.tar.gz: b11c495203dc16e9668430a70f35ba93abe5126db80dbf04c773b72a609b34c8
3
+ metadata.gz: fa1902916e0f5d7d7e6f55abac75be8b7766b42ce209b7a1a166e146554994ba
4
+ data.tar.gz: 295926d043977eb7001e89215848f16d527e6141e0d7c23d29db147d635b732a
5
5
  SHA512:
6
- metadata.gz: 9b6b842173b961104f45a2a5bc2dc6c1924d012aed19c114d748f8d85c94ae3510b4b7cf8db18a8df7790b19e57ab08b5ff2b7a5bc1ef50509f250a73cbcfce1
7
- data.tar.gz: 480d5730ff338bc4bb4a1045df02fd0adfeef8cdc468e1c53977751917a243172f7b97e58b363175fe0566658c04a4c27db8282f0afc4707e1daf091419c47b4
6
+ metadata.gz: 79cdda51880bc12d8d3c02bfcf07a8776f0dc18e6b3ee8daa5e3654786cc0fc4116c0d839f36a6cb7803b927e0f34cc37de32b447e906e11575f668dcf06a371
7
+ data.tar.gz: ca5da85ee4a5fe13032229c95d41e8d12d258e2809f85a3cd268a8e4b7752c637b764d5a0d6bec466ceb68ba09005fb026815fff884178b5900bbdd64aa3329e
data/doc/text/news.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # News
2
2
 
3
+ ## 3.4.7: 2023-08-17 {#version-3-4-7}
4
+
5
+ ### Fixes
6
+
7
+ * po: Fixed a parser bug that it may add a `fuzzy` flag to non-fuzzy
8
+ entry with `ignore_fuzzy: true`.
9
+
10
+ Example PO:
11
+
12
+ ```po
13
+ #, fuzzy
14
+ #: file.rb:10
15
+ msgid "hello"
16
+ msgstr "bonjour"
17
+
18
+ msgid "non-fuzzy"
19
+ msgstr "non-fuzzy string"
20
+ ```
21
+
22
+ `hello` entry is ignored because `ignore_fuzzy` is `true`. The
23
+ `fuzzy` flag in the `hello` entry is added to `non-fuzzy` entry.
24
+
3
25
  ## 3.4.6: 2023-07-12 {#version-3-4-6}
4
26
 
5
27
  ### Fixes
@@ -19,7 +19,7 @@ require "gettext/po"
19
19
  module GetText
20
20
  class POParser < Racc::Parser
21
21
 
22
- module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 122)
22
+ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
23
23
  if GetText.respond_to?(:bindtextdomain)
24
24
  include GetText
25
25
  GetText.bindtextdomain("gettext")
@@ -62,16 +62,8 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 122)
62
62
  private :unescape
63
63
 
64
64
  def parse(str, data)
65
- @translator_comments = []
66
- @extracted_comments = []
67
- @references = []
68
- @flags = []
69
- @previous = []
70
- @comments = []
65
+ clear
71
66
  @data = data
72
- @fuzzy = false
73
- @msgctxt = nil
74
- @msgid_plural = nil
75
67
 
76
68
  str = str.strip
77
69
  @q = []
@@ -157,15 +149,7 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 122)
157
149
  @data.set_comment(msgid, format_comment(@comments))
158
150
  end
159
151
 
160
- @translator_comments = []
161
- @extracted_comments = []
162
- @references = []
163
- @flags = []
164
- @previous = []
165
- @references = []
166
- @comments.clear
167
- @msgctxt = nil
168
- @msgid_plural = nil
152
+ clear
169
153
  end
170
154
 
171
155
  def format_comment(comments)
@@ -263,6 +247,18 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 122)
263
247
  def parse_flags_line(line)
264
248
  line.split(/\s+/)
265
249
  end
250
+
251
+ def clear
252
+ @translator_comments = []
253
+ @extracted_comments = []
254
+ @references = []
255
+ @flags = []
256
+ @previous = []
257
+ @references = []
258
+ @comments = []
259
+ @msgctxt = nil
260
+ @msgid_plural = nil
261
+ end
266
262
  ...end po_parser.ry/module_eval...
267
263
  ##### State transition tables begin ###
268
264
 
@@ -417,14 +413,18 @@ module_eval(<<'.,.,', 'po_parser.ry', 38)
417
413
  end
418
414
  end
419
415
  @fuzzy = false
420
- on_message(msgid, msgstr) if use_message_p
416
+ if use_message_p
417
+ on_message(msgid, msgstr)
418
+ else
419
+ clear
420
+ end
421
421
  result = ""
422
422
 
423
423
  result
424
424
  end
425
425
  .,.,
426
426
 
427
- module_eval(<<'.,.,', 'po_parser.ry', 60)
427
+ module_eval(<<'.,.,', 'po_parser.ry', 64)
428
428
  def _reduce_9(val, _values, result)
429
429
  if @fuzzy and ignore_fuzzy?
430
430
  if val[1] != ""
@@ -446,7 +446,7 @@ module_eval(<<'.,.,', 'po_parser.ry', 60)
446
446
  end
447
447
  .,.,
448
448
 
449
- module_eval(<<'.,.,', 'po_parser.ry', 81)
449
+ module_eval(<<'.,.,', 'po_parser.ry', 85)
450
450
  def _reduce_10(val, _values, result)
451
451
  if val[0].size > 0
452
452
  result = val[0] + "\000" + val[1]
@@ -460,7 +460,7 @@ module_eval(<<'.,.,', 'po_parser.ry', 81)
460
460
 
461
461
  # reduce 11 omitted
462
462
 
463
- module_eval(<<'.,.,', 'po_parser.ry', 93)
463
+ module_eval(<<'.,.,', 'po_parser.ry', 97)
464
464
  def _reduce_12(val, _values, result)
465
465
  result = val[2]
466
466
 
@@ -468,7 +468,7 @@ module_eval(<<'.,.,', 'po_parser.ry', 93)
468
468
  end
469
469
  .,.,
470
470
 
471
- module_eval(<<'.,.,', 'po_parser.ry', 100)
471
+ module_eval(<<'.,.,', 'po_parser.ry', 104)
472
472
  def _reduce_13(val, _values, result)
473
473
  on_comment(val[0])
474
474
 
@@ -476,7 +476,7 @@ module_eval(<<'.,.,', 'po_parser.ry', 100)
476
476
  end
477
477
  .,.,
478
478
 
479
- module_eval(<<'.,.,', 'po_parser.ry', 108)
479
+ module_eval(<<'.,.,', 'po_parser.ry', 112)
480
480
  def _reduce_14(val, _values, result)
481
481
  result = val.delete_if{|item| item == ""}.join
482
482
 
@@ -484,7 +484,7 @@ module_eval(<<'.,.,', 'po_parser.ry', 108)
484
484
  end
485
485
  .,.,
486
486
 
487
- module_eval(<<'.,.,', 'po_parser.ry', 112)
487
+ module_eval(<<'.,.,', 'po_parser.ry', 116)
488
488
  def _reduce_15(val, _values, result)
489
489
  result = val[0]
490
490
 
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
4
2
  #
5
3
  # License: Ruby's or LGPL
6
4
  #
@@ -452,8 +450,8 @@ module GetText
452
450
  locale = args.locale || ENV["LOCALE"]
453
451
  if locale.nil?
454
452
  raise "specify locale name by " +
455
- "'rake #{_task.name}[${LOCALE}]' or " +
456
- "rake #{_task.name} LOCALE=${LOCALE}'"
453
+ "rake '#{_task.name}[${LOCALE}]' or " +
454
+ "rake #{_task.name} LOCALE=${LOCALE}'"
457
455
  end
458
456
  define_edit_po_file_task(locale)
459
457
  define_po_file_task(locale)
@@ -9,5 +9,5 @@
9
9
  =end
10
10
 
11
11
  module GetText
12
- VERSION = "3.4.6"
12
+ VERSION = "3.4.7"
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.4.6\n"
9
+ "Project-Id-Version: gettext 3.4.7\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2023-07-12 10:23+0900\n"
12
- "PO-Revision-Date: 2023-07-12 10:23+0900\n"
11
+ "POT-Creation-Date: 2023-08-17 17:02+0900\n"
12
+ "PO-Revision-Date: 2023-08-17 17:02+0900\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
data/src/po_parser.ry CHANGED
@@ -2,9 +2,9 @@
2
2
  #
3
3
  # po_parser.ry - ruby version of msgfmt
4
4
  #
5
- # Copyright (C) 2002-2008 Masao Mutoh <mutomasa at gmail.com>
6
- # Copyright (C) 2012-2017 Kouhei Sutou <kou@clear-code.com>
7
- # Copyright (C) 2012-2013 Haruka Yoshihara <yoshihara@clear-code.com>
5
+ # Copyright (C) 2002-2008 Masao Mutoh <mutomasa at gmail.com>
6
+ # Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
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
10
10
  # license terms as Ruby or LGPL.
@@ -51,7 +51,11 @@ class GetText::POParser
51
51
  end
52
52
  end
53
53
  @fuzzy = false
54
- on_message(msgid, msgstr) if use_message_p
54
+ if use_message_p
55
+ on_message(msgid, msgstr)
56
+ else
57
+ clear
58
+ end
55
59
  result = ""
56
60
  }
57
61
 
@@ -161,16 +165,8 @@ require "gettext/po"
161
165
  private :unescape
162
166
 
163
167
  def parse(str, data)
164
- @translator_comments = []
165
- @extracted_comments = []
166
- @references = []
167
- @flags = []
168
- @previous = []
169
- @comments = []
168
+ clear
170
169
  @data = data
171
- @fuzzy = false
172
- @msgctxt = nil
173
- @msgid_plural = nil
174
170
 
175
171
  str = str.strip
176
172
  @q = []
@@ -256,15 +252,7 @@ require "gettext/po"
256
252
  @data.set_comment(msgid, format_comment(@comments))
257
253
  end
258
254
 
259
- @translator_comments = []
260
- @extracted_comments = []
261
- @references = []
262
- @flags = []
263
- @previous = []
264
- @references = []
265
- @comments.clear
266
- @msgctxt = nil
267
- @msgid_plural = nil
255
+ clear
268
256
  end
269
257
 
270
258
  def format_comment(comments)
@@ -362,5 +350,17 @@ require "gettext/po"
362
350
  def parse_flags_line(line)
363
351
  line.split(/\s+/)
364
352
  end
353
+
354
+ def clear
355
+ @translator_comments = []
356
+ @extracted_comments = []
357
+ @references = []
358
+ @flags = []
359
+ @previous = []
360
+ @references = []
361
+ @comments = []
362
+ @msgctxt = nil
363
+ @msgid_plural = nil
364
+ end
365
365
  ---- footer
366
366
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
2
2
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
3
3
  #
4
4
  # License: Ruby's or LGPL
@@ -238,6 +238,33 @@ EOP
238
238
  assert_equal("fuzzy", entries["hello"].flag)
239
239
  end
240
240
 
241
+ def test_fuzzy_ignore
242
+ po_file = create_po_file(<<-PO)
243
+ #, fuzzy
244
+ #: file.rb:10
245
+ msgid "hello"
246
+ msgstr "bonjour"
247
+
248
+ msgid "non-fuzzy"
249
+ msgstr "non-fuzzy string"
250
+ PO
251
+ entries = suppress_warning do
252
+ parse_po_file(po_file)
253
+ end
254
+
255
+ actual = entries.collect do |entry|
256
+ [
257
+ entry.msgid,
258
+ entry.msgstr,
259
+ entry.flags,
260
+ ]
261
+ end
262
+ assert_equal([
263
+ ["non-fuzzy", "non-fuzzy string", []],
264
+ ],
265
+ actual)
266
+ end
267
+
241
268
  private
242
269
  def parse_po_file(po_file, options={:ignore_fuzzy => true})
243
270
  ignore_fuzzy = options[:ignore_fuzzy]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.6
4
+ version: 3.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-12 00:00:00.000000000 Z
12
+ date: 2023-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubi