gettext 3.4.7 → 3.4.8

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: fa1902916e0f5d7d7e6f55abac75be8b7766b42ce209b7a1a166e146554994ba
4
- data.tar.gz: 295926d043977eb7001e89215848f16d527e6141e0d7c23d29db147d635b732a
3
+ metadata.gz: 935189b8e4a67d110df2c1e21b89bab5f70057772c31861d58c1d71935e4ace3
4
+ data.tar.gz: ee204b53fee909a7a23921a814fc3046312fe8fc6f3f576b7b883a2920896d02
5
5
  SHA512:
6
- metadata.gz: 79cdda51880bc12d8d3c02bfcf07a8776f0dc18e6b3ee8daa5e3654786cc0fc4116c0d839f36a6cb7803b927e0f34cc37de32b447e906e11575f668dcf06a371
7
- data.tar.gz: ca5da85ee4a5fe13032229c95d41e8d12d258e2809f85a3cd268a8e4b7752c637b764d5a0d6bec466ceb68ba09005fb026815fff884178b5900bbdd64aa3329e
6
+ metadata.gz: a91c277a26e46db88ff1d67c85a2d0932a22cf0043d74cec373119dea8431614dfd35a2ddaef7ed18b557c07bdd27b60c3e8bf6fe79e7da80e42160f30883786
7
+ data.tar.gz: 00cd6a8ba2be7a06b9b9c7d5d8cc6e5f92bfbe768a32237dfcb029a105cd1b6508db88fb8988027c639d7bc385f43246d79513d5d4cc912d5e632ecbb5014c28
data/README.md CHANGED
@@ -244,11 +244,11 @@ n_(fruits, 3)
244
244
 
245
245
  ### Interpolating translations
246
246
 
247
- This is not a feature of gettext but worth noting. You can interpolate translated strings without the ruby String `%` operator.
247
+ This is not a feature of gettext but worth noting. You can interpolate translated strings with the ruby String `%` operator.
248
248
 
249
249
  ```ruby
250
250
  N_("active"); N_("inactive"); N_("paused") # possible value of status for parser to find.
251
- _("Your account is #{account_state}.") % { account_state: _(status) }
251
+ _("Your account is %{account_state}.") % { account_state: _(status) }
252
252
  ```
253
253
 
254
254
 
data/doc/text/news.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # News
2
2
 
3
+ ## 3.4.8: 2023-10-22 {#version-3-4-8}
4
+
5
+ ### Fixes
6
+
7
+ * doc: Fixed a wrong description for interpolation.
8
+ * GH-102
9
+ * Patch by Ilmari Karonen
10
+
11
+ * po: Fixed a parser bug that flags aren't parsed correctly. If a
12
+ normal comment has "fuzzy", the entry is also treated as a fuzzy
13
+ entry.
14
+
15
+ * po: Fixed an output bug that flags aren't formatted correctly.
16
+ * GH-105
17
+ * Patch by Yoshikazu Nojima
18
+
19
+ ### Thanks
20
+
21
+ * Ilmari Karonen
22
+
23
+ * Yoshikazu Nojima
24
+
3
25
  ## 3.4.7: 2023-08-17 {#version-3-4-7}
4
26
 
5
27
  ### Fixes
@@ -428,11 +428,12 @@ module GetText
428
428
  end
429
429
 
430
430
  def format_flag_comment
431
- formatted_flags = String.new
432
- @entry.flags.each do |flag|
433
- formatted_flags << format_comment(FLAG_MARK, flag)
431
+ if @entry.flags.empty?
432
+ String.new
433
+ else
434
+ joined_flags = @entry.flags.join(", ")
435
+ format_comment(FLAG_MARK, joined_flags)
434
436
  end
435
- formatted_flags
436
437
  end
437
438
 
438
439
  def format_previous_comment
@@ -161,7 +161,11 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
161
161
  end
162
162
 
163
163
  def on_comment(comment)
164
- @fuzzy = true if (/fuzzy/ =~ comment)
164
+ if comment.start_with?(POFormat::FLAG_MARK)
165
+ content = comment[POFormat::FLAG_MARK.size..-1]
166
+ flags = parse_flags_line(content)
167
+ @fuzzy = true if flags.include?("fuzzy")
168
+ end
165
169
  if @data.instance_of?(PO)
166
170
  if comment == "#"
167
171
  @translator_comments << ""
@@ -176,7 +180,7 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
176
180
  when POFormat::REFERENCE_COMMENT_MARK
177
181
  @references.concat(parse_references_line(content))
178
182
  when POFormat::FLAG_MARK
179
- @flags.concat(parse_flags_line(content))
183
+ @flags.concat(flags)
180
184
  when POFormat::PREVIOUS_COMMENT_MARK
181
185
  @previous << content
182
186
  else
@@ -245,7 +249,7 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
245
249
  end
246
250
 
247
251
  def parse_flags_line(line)
248
- line.split(/\s+/)
252
+ line.split(",").collect(&:strip)
249
253
  end
250
254
 
251
255
  def clear
@@ -1,13 +1,13 @@
1
1
  =begin
2
2
  version - version information of gettext
3
3
 
4
- Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
5
- Copyright (C) 2005-2009 Masao Mutoh
4
+ Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
5
+ Copyright (C) 2005-2009 Masao Mutoh
6
6
 
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby or LGPL.
9
9
  =end
10
10
 
11
11
  module GetText
12
- VERSION = "3.4.7"
12
+ VERSION = "3.4.8"
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.7\n"
9
+ "Project-Id-Version: gettext 3.4.8\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2023-08-17 17:02+0900\n"
12
- "PO-Revision-Date: 2023-08-17 17:02+0900\n"
11
+ "POT-Creation-Date: 2023-10-22 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-10-22 06:20+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
@@ -264,7 +264,11 @@ require "gettext/po"
264
264
  end
265
265
 
266
266
  def on_comment(comment)
267
- @fuzzy = true if (/fuzzy/ =~ comment)
267
+ if comment.start_with?(POFormat::FLAG_MARK)
268
+ content = comment[POFormat::FLAG_MARK.size..-1]
269
+ flags = parse_flags_line(content)
270
+ @fuzzy = flags.include?("fuzzy")
271
+ end
268
272
  if @data.instance_of?(PO)
269
273
  if comment == "#"
270
274
  @translator_comments << ""
@@ -279,7 +283,7 @@ require "gettext/po"
279
283
  when POFormat::REFERENCE_COMMENT_MARK
280
284
  @references.concat(parse_references_line(content))
281
285
  when POFormat::FLAG_MARK
282
- @flags.concat(parse_flags_line(content))
286
+ @flags.concat(flags)
283
287
  when POFormat::PREVIOUS_COMMENT_MARK
284
288
  @previous << content
285
289
  else
@@ -348,7 +352,7 @@ require "gettext/po"
348
352
  end
349
353
 
350
354
  def parse_flags_line(line)
351
- line.split(/\s+/)
355
+ line.split(",").collect(&:strip)
352
356
  end
353
357
 
354
358
  def clear
@@ -344,6 +344,20 @@ EOP
344
344
  assert_equal(expected_po, entry.to_s)
345
345
  end
346
346
 
347
+ def test_multiple_flags
348
+ entry = GetText::POEntry.new(:normal)
349
+ entry.msgid = "msgid"
350
+ entry.msgstr = "msgstr"
351
+ entry.flags = ["It's the flag.", "fuzzy"]
352
+
353
+ expected_po = <<-EOP
354
+ #, It's the flag., fuzzy
355
+ msgid "msgid"
356
+ msgstr "msgstr"
357
+ EOP
358
+ assert_equal(expected_po, entry.to_s)
359
+ end
360
+
347
361
  def test_previous
348
362
  entry = GetText::POEntry.new(:normal)
349
363
  entry.msgid = "msgid"
@@ -245,6 +245,12 @@ EOP
245
245
  msgid "hello"
246
246
  msgstr "bonjour"
247
247
 
248
+ #, c-format, fuzzy , no-sh-format
249
+ #: file.rb:11
250
+ msgid "world"
251
+ msgstr "monde"
252
+
253
+ # This is not fuzzy
248
254
  msgid "non-fuzzy"
249
255
  msgstr "non-fuzzy string"
250
256
  PO
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.7
4
+ version: 3.4.8
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-08-17 00:00:00.000000000 Z
12
+ date: 2023-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubi