gettext 3.4.7 → 3.4.9

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/doc/text/news.md +29 -0
  4. data/lib/gettext/po_entry.rb +28 -19
  5. data/lib/gettext/po_parser.rb +7 -3
  6. data/lib/gettext/tools/msgcat.rb +9 -2
  7. data/lib/gettext/tools/msgmerge.rb +11 -6
  8. data/lib/gettext/tools/xgettext.rb +9 -4
  9. data/lib/gettext/version.rb +3 -3
  10. data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
  11. data/po/bg/gettext.edit.po +60 -56
  12. data/po/bg/gettext.po +3 -0
  13. data/po/bs/gettext.edit.po +60 -56
  14. data/po/bs/gettext.po +3 -0
  15. data/po/ca/gettext.edit.po +60 -56
  16. data/po/ca/gettext.po +3 -0
  17. data/po/cs/gettext.edit.po +60 -56
  18. data/po/cs/gettext.po +3 -0
  19. data/po/de/gettext.edit.po +60 -56
  20. data/po/de/gettext.po +3 -0
  21. data/po/el/gettext.edit.po +60 -56
  22. data/po/el/gettext.po +3 -0
  23. data/po/eo/gettext.edit.po +60 -56
  24. data/po/eo/gettext.po +3 -0
  25. data/po/es/gettext.edit.po +60 -56
  26. data/po/es/gettext.po +3 -0
  27. data/po/et/gettext.edit.po +60 -56
  28. data/po/et/gettext.po +3 -0
  29. data/po/fr/gettext.edit.po +60 -56
  30. data/po/fr/gettext.po +3 -0
  31. data/po/gettext.pot +72 -67
  32. data/po/hr/gettext.edit.po +60 -56
  33. data/po/hr/gettext.po +3 -0
  34. data/po/hu/gettext.edit.po +60 -56
  35. data/po/hu/gettext.po +3 -0
  36. data/po/it/gettext.edit.po +60 -56
  37. data/po/it/gettext.po +3 -0
  38. data/po/ja/gettext.edit.po +61 -57
  39. data/po/ja/gettext.po +4 -1
  40. data/po/ko/gettext.edit.po +60 -56
  41. data/po/ko/gettext.po +3 -0
  42. data/po/lv/gettext.edit.po +60 -56
  43. data/po/lv/gettext.po +3 -0
  44. data/po/nb/gettext.edit.po +60 -56
  45. data/po/nb/gettext.po +3 -0
  46. data/po/nl/gettext.edit.po +60 -56
  47. data/po/nl/gettext.po +3 -0
  48. data/po/pt_BR/gettext.edit.po +60 -56
  49. data/po/pt_BR/gettext.po +3 -0
  50. data/po/ru/gettext.edit.po +60 -56
  51. data/po/ru/gettext.po +3 -0
  52. data/po/sr/gettext.edit.po +60 -56
  53. data/po/sr/gettext.po +3 -0
  54. data/po/sv/gettext.edit.po +60 -56
  55. data/po/sv/gettext.po +3 -0
  56. data/po/uk/gettext.edit.po +60 -56
  57. data/po/uk/gettext.po +3 -0
  58. data/po/vi/gettext.edit.po +60 -56
  59. data/po/vi/gettext.po +3 -0
  60. data/po/zh/gettext.edit.po +60 -56
  61. data/po/zh/gettext.po +3 -0
  62. data/po/zh_TW/gettext.edit.po +60 -56
  63. data/po/zh_TW/gettext.po +3 -0
  64. data/src/po_parser.ry +7 -3
  65. data/test/locale/ja/LC_MESSAGES/_.mo +0 -0
  66. data/test/po/ja/_.edit.po +3 -3
  67. data/test/test_po_entry.rb +14 -0
  68. data/test/test_po_parser.rb +6 -0
  69. data/test/tools/test_msgcat.rb +21 -1
  70. data/test/tools/test_msgmerge.rb +41 -3
  71. data/test/tools/test_xgettext.rb +15 -3
  72. metadata +2 -2
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
Binary file
data/test/po/ja/_.edit.po CHANGED
@@ -5,7 +5,7 @@
5
5
  msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: PACKAGE VERSION\n"
8
- "PO-Revision-Date: 2018-06-17 07:37+0900\n"
8
+ "PO-Revision-Date: 2023-10-22 06:37+0900\n"
9
9
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
10
10
  "Language-Team: LANGUAGE <LL@li.org>\n"
11
11
  "MIME-Version: 1.0\n"
@@ -84,8 +84,8 @@ msgid "#"
84
84
  msgstr ""
85
85
 
86
86
  #: ../fixtures/_.rb:96
87
- msgid "\taaa'bbb\\ccc"
88
- msgstr ""
87
+ msgid "\\taaa'bbb\\ccc"
88
+ msgstr "AAA"
89
89
 
90
90
  #: ../fixtures/_.rb:100
91
91
  msgid ""
@@ -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
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2014-2023 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # License: Ruby's or LGPL
4
4
  #
@@ -243,6 +243,7 @@ msgstr ""
243
243
  @po = <<-PO
244
244
  # translator comment
245
245
  #: a.rb:1
246
+ #: a.rb:2
246
247
  msgid "Hello"
247
248
  msgstr ""
248
249
  PO
@@ -252,6 +253,25 @@ msgstr ""
252
253
  assert_equal(<<-PO, run_msgcat([@po], "--no-location"))
253
254
  # translator comment
254
255
  msgid "Hello"
256
+ msgstr ""
257
+ PO
258
+ end
259
+
260
+ def test_wrap
261
+ assert_equal(<<-PO, run_msgcat([@po], "--wrap"))
262
+ # translator comment
263
+ #: a.rb:1 a.rb:2
264
+ msgid "Hello"
265
+ msgstr ""
266
+ PO
267
+ end
268
+
269
+ def test_use_one_line_per_reference
270
+ assert_equal(<<-PO, run_msgcat([@po], "--wrap", "--use-one-line-per-reference"))
271
+ # translator comment
272
+ #: a.rb:1
273
+ #: a.rb:2
274
+ msgid "Hello"
255
275
  msgstr ""
256
276
  PO
257
277
  end
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
4
2
  # Copyright (C) 2010 Eddie Lau <tatonlto@gmail.com>
5
3
  #
6
4
  # License: Ruby's or LGPL
@@ -654,6 +652,46 @@ msgstr ""
654
652
  end
655
653
  end
656
654
 
655
+ class TestUseOneLinePerReference < self
656
+ def pot_content
657
+ super + <<-POT
658
+
659
+ #: hello.rb:10
660
+ #: hello.rb:20
661
+ #: hello.rb:30
662
+ msgid "Good morning"
663
+ msgstr ""
664
+ POT
665
+ end
666
+
667
+ def test_with_wrap
668
+ @msgmerge.run("--update",
669
+ "--wrap",
670
+ "--use-one-line-per-reference",
671
+ @po_file_path, @pot_file_path)
672
+ assert_equal(<<-PO, File.read(@po_file_path))
673
+ #{po_header(@pot_formatted_time, @po_formatted_time)}
674
+ #: hello.rb:1
675
+ msgid "Hello"
676
+ msgstr ""
677
+
678
+ #: hello.rb:2
679
+ msgid "World"
680
+ msgstr "Translated World"
681
+
682
+ #: hello.rb:3
683
+ msgid "Good-bye"
684
+ msgstr ""
685
+
686
+ #: hello.rb:10
687
+ #: hello.rb:20
688
+ #: hello.rb:30
689
+ msgid "Good morning"
690
+ msgstr ""
691
+ PO
692
+ end
693
+ end
694
+
657
695
  class TestWidth < self
658
696
  def pot_content
659
697
  <<-POT
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
4
2
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
5
3
  #
6
4
  # License: Ruby's or LGPL
@@ -116,6 +114,20 @@ msgid "Hello"
116
114
  msgstr ""
117
115
  EOP
118
116
  end
117
+
118
+ def test_use_one_line_per_reference
119
+ pot_content = generate(<<-RUBY, "--use-one-line-per-reference")
120
+ _("Hello")
121
+ _("Hello")
122
+ RUBY
123
+ assert_equal(<<-POT, pot_content)
124
+ #{header}
125
+ #: ../lib/xgettext.rb:1
126
+ #: ../lib/xgettext.rb:2
127
+ msgid "Hello"
128
+ msgstr ""
129
+ POT
130
+ end
119
131
  end
120
132
 
121
133
  class TestParser < self
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.9
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