gettext 3.3.7 → 3.4.1

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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -0
  3. data/doc/text/news.md +58 -0
  4. data/gettext.gemspec +5 -4
  5. data/lib/gettext/mo.rb +7 -5
  6. data/lib/gettext/tools/msginit.rb +221 -50
  7. data/lib/gettext/tools/parser/glade.rb +38 -40
  8. data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +6 -3
  9. data/lib/gettext/tools/parser/ruby.rb +2 -2
  10. data/lib/gettext/version.rb +2 -2
  11. data/locale/bg/LC_MESSAGES/gettext.mo +0 -0
  12. data/locale/bs/LC_MESSAGES/gettext.mo +0 -0
  13. data/locale/ca/LC_MESSAGES/gettext.mo +0 -0
  14. data/locale/cs/LC_MESSAGES/gettext.mo +0 -0
  15. data/locale/de/LC_MESSAGES/gettext.mo +0 -0
  16. data/locale/el/LC_MESSAGES/gettext.mo +0 -0
  17. data/locale/eo/LC_MESSAGES/gettext.mo +0 -0
  18. data/locale/es/LC_MESSAGES/gettext.mo +0 -0
  19. data/locale/et/LC_MESSAGES/gettext.mo +0 -0
  20. data/locale/fr/LC_MESSAGES/gettext.mo +0 -0
  21. data/locale/hr/LC_MESSAGES/gettext.mo +0 -0
  22. data/locale/hu/LC_MESSAGES/gettext.mo +0 -0
  23. data/locale/it/LC_MESSAGES/gettext.mo +0 -0
  24. data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
  25. data/locale/ko/LC_MESSAGES/gettext.mo +0 -0
  26. data/locale/lv/LC_MESSAGES/gettext.mo +0 -0
  27. data/locale/nb/LC_MESSAGES/gettext.mo +0 -0
  28. data/locale/nl/LC_MESSAGES/gettext.mo +0 -0
  29. data/locale/pt_BR/LC_MESSAGES/gettext.mo +0 -0
  30. data/locale/ru/LC_MESSAGES/gettext.mo +0 -0
  31. data/locale/sr/LC_MESSAGES/gettext.mo +0 -0
  32. data/locale/uk/LC_MESSAGES/gettext.mo +0 -0
  33. data/locale/vi/LC_MESSAGES/gettext.mo +0 -0
  34. data/locale/zh/LC_MESSAGES/gettext.mo +0 -0
  35. data/locale/zh_TW/LC_MESSAGES/gettext.mo +0 -0
  36. data/po/bg/gettext.edit.po +19 -537
  37. data/po/bg/gettext.po +0 -423
  38. data/po/bs/gettext.edit.po +19 -537
  39. data/po/bs/gettext.po +0 -423
  40. data/po/ca/gettext.edit.po +19 -537
  41. data/po/ca/gettext.po +0 -423
  42. data/po/cs/gettext.edit.po +19 -537
  43. data/po/cs/gettext.po +0 -423
  44. data/po/de/gettext.edit.po +19 -537
  45. data/po/de/gettext.po +0 -423
  46. data/po/el/gettext.edit.po +19 -537
  47. data/po/el/gettext.po +0 -423
  48. data/po/eo/gettext.edit.po +19 -537
  49. data/po/eo/gettext.po +0 -423
  50. data/po/es/gettext.edit.po +19 -537
  51. data/po/es/gettext.po +0 -423
  52. data/po/et/gettext.edit.po +19 -537
  53. data/po/et/gettext.po +0 -423
  54. data/po/fr/gettext.edit.po +19 -537
  55. data/po/fr/gettext.po +0 -423
  56. data/po/gettext.pot +20 -602
  57. data/po/hr/gettext.edit.po +19 -537
  58. data/po/hr/gettext.po +0 -423
  59. data/po/hu/gettext.edit.po +19 -537
  60. data/po/hu/gettext.po +0 -423
  61. data/po/it/gettext.edit.po +19 -537
  62. data/po/it/gettext.po +0 -423
  63. data/po/ja/gettext.edit.po +19 -537
  64. data/po/ja/gettext.po +0 -423
  65. data/po/ko/gettext.edit.po +19 -537
  66. data/po/ko/gettext.po +0 -423
  67. data/po/lv/gettext.edit.po +19 -537
  68. data/po/lv/gettext.po +0 -423
  69. data/po/nb/gettext.edit.po +19 -537
  70. data/po/nb/gettext.po +0 -423
  71. data/po/nl/gettext.edit.po +19 -537
  72. data/po/nl/gettext.po +0 -423
  73. data/po/pt_BR/gettext.edit.po +19 -537
  74. data/po/pt_BR/gettext.po +0 -423
  75. data/po/ru/gettext.edit.po +19 -537
  76. data/po/ru/gettext.po +0 -423
  77. data/po/sr/gettext.edit.po +19 -537
  78. data/po/sr/gettext.po +0 -423
  79. data/po/sv/gettext.edit.po +17 -538
  80. data/po/sv/gettext.po +0 -423
  81. data/po/uk/gettext.edit.po +19 -537
  82. data/po/uk/gettext.po +0 -423
  83. data/po/vi/gettext.edit.po +19 -537
  84. data/po/vi/gettext.po +0 -423
  85. data/po/zh/gettext.edit.po +19 -537
  86. data/po/zh/gettext.po +0 -423
  87. data/po/zh_TW/gettext.edit.po +19 -537
  88. data/po/zh_TW/gettext.po +0 -423
  89. data/test/fixtures/_.rb +1 -1
  90. data/test/fixtures/{gladeparser.glade → glade/2.glade} +0 -0
  91. data/test/fixtures/glade/3.glade +63 -0
  92. data/test/fixtures/multi_text_domain.rb +12 -12
  93. data/test/fixtures/np_.rb +1 -1
  94. data/test/fixtures/ns_.rb +1 -1
  95. data/test/fixtures/p_.rb +1 -1
  96. data/test/fixtures/ruby/{percent_i.rb → percent_lower_i.rb} +0 -0
  97. data/test/fixtures/ruby/{percent_w.rb → percent_lower_w.rb} +0 -0
  98. data/test/fixtures/ruby/{percent_I.rb → percent_upper_i.rb} +0 -0
  99. data/test/fixtures/ruby/{percent_W.rb → percent_upper_w.rb} +0 -0
  100. data/test/fixtures/s_.rb +1 -1
  101. data/test/fixtures/simple.rb +1 -1
  102. data/test/fixtures/upper_nn_.rb +77 -0
  103. data/test/po/_.pot +20 -4
  104. data/test/po/ja/_.edit.po +24 -0
  105. data/test/po/np_.pot +8 -5
  106. data/test/po/ns_.pot +6 -4
  107. data/test/po/p_.pot +3 -3
  108. data/test/po/s_.pot +6 -4
  109. data/test/test_parser.rb +35 -17
  110. data/test/tools/parser/test_glade.rb +91 -0
  111. data/test/tools/parser/test_gtk_builder_ui_definitions.rb +19 -1
  112. data/test/tools/parser/test_ruby.rb +4 -4
  113. data/test/tools/test_msginit.rb +82 -3
  114. metadata +29 -11
@@ -0,0 +1,91 @@
1
+ # Copyright (C) 2009-2010 Masao Mutoh
2
+ # Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
3
+ #
4
+ # License: Ruby's or LGPL
5
+ #
6
+ # This library is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public License
17
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require "gettext/tools/parser/glade"
20
+
21
+ class TestGladeParser < Test::Unit::TestCase
22
+ include Helper::Parser
23
+
24
+ def parse(file)
25
+ GetText::GladeParser.parse(fixture_path(file))
26
+ end
27
+
28
+ def test_2
29
+ assert_parse([
30
+ {
31
+ msgid: "window1",
32
+ references: ["glade/2.glade:8"],
33
+ },
34
+ {
35
+ msgid: "normal text",
36
+ references: ["glade/2.glade:29"],
37
+ },
38
+ {
39
+ msgid: "1st line\n2nd line\n3rd line",
40
+ references: ["glade/2.glade:50"],
41
+ },
42
+ {
43
+ msgid:
44
+ "<span color=\"red\" " +
45
+ "weight=\"bold\" " +
46
+ "size=\"large\">markup </span>",
47
+ references: ["glade/2.glade:73"],
48
+ },
49
+ {
50
+ msgid:
51
+ "<span color=\"red\">1st line markup </span>\n" +
52
+ "<span color=\"blue\">2nd line markup</span>",
53
+ references: ["glade/2.glade:94"],
54
+ },
55
+ {
56
+ msgid:
57
+ "<span>" +
58
+ "&quot;markup&quot; with &lt;escaped strings&gt;" +
59
+ "</span>",
60
+ references: ["glade/2.glade:116"],
61
+ },
62
+ {
63
+ msgid: "duplicated",
64
+ references: [
65
+ "glade/2.glade:137",
66
+ "glade/2.glade:158",
67
+ ],
68
+ },
69
+ ],
70
+ "glade/2.glade")
71
+ end
72
+
73
+
74
+ class TestDetect < self
75
+ def target?(file)
76
+ GetText::GladeParser.target?(fixture_path(file))
77
+ end
78
+
79
+ def test_2
80
+ assert do
81
+ target?("glade/2.glade")
82
+ end
83
+ end
84
+
85
+ def test_3
86
+ assert do
87
+ not target?("glade/3.glade")
88
+ end
89
+ end
90
+ end
91
+ end
@@ -24,7 +24,7 @@ class TestGtkBuilderUIDefinitionsParser < Test::Unit::TestCase
24
24
  GetText::GtkBuilderUIDefinitionsParser.parse(fixture_path(file))
25
25
  end
26
26
 
27
- def test_all
27
+ def test_ui
28
28
  assert_parse([
29
29
  {
30
30
  :msgid => "label with context",
@@ -42,4 +42,22 @@ class TestGtkBuilderUIDefinitionsParser < Test::Unit::TestCase
42
42
  ],
43
43
  "gtk_builder_ui_definitions.ui")
44
44
  end
45
+
46
+ class TestDetect < self
47
+ def target?(file)
48
+ GetText::GtkBuilderUIDefinitionsParser.target?(fixture_path(file))
49
+ end
50
+
51
+ def test_ui
52
+ assert do
53
+ target?("gtk_builder_ui_definitions.ui")
54
+ end
55
+ end
56
+
57
+ def test_glade_3
58
+ assert do
59
+ target?("glade/3.glade")
60
+ end
61
+ end
62
+ end
45
63
  end
@@ -285,22 +285,22 @@ class TestRubyParser < Test::Unit::TestCase
285
285
  sub_test_case("parse") do
286
286
  def test_percent_w
287
287
  assert_parse([],
288
- "percent_w.rb")
288
+ "percent_lower_w.rb")
289
289
  end
290
290
 
291
291
  def test_percent_W
292
292
  assert_parse([],
293
- "percent_W.rb")
293
+ "percent_upper_w.rb")
294
294
  end
295
295
 
296
296
  def test_percent_i
297
297
  assert_parse([],
298
- "percent_i.rb")
298
+ "percent_lower_i.rb")
299
299
  end
300
300
 
301
301
  def test_percent_I
302
302
  assert_parse([],
303
- "percent_I.rb")
303
+ "percent_upper_i.rb")
304
304
  end
305
305
 
306
306
  private
@@ -1,7 +1,5 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
1
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2012-2017 Kouhei Sutou <kou@clear-code.com>
2
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
5
3
  #
6
4
  # License: Ruby's or LGPL
7
5
  #
@@ -314,6 +312,11 @@ EOF
314
312
  end
315
313
 
316
314
  class TestPluralForms < self
315
+ def setup
316
+ super
317
+ omit("Red Datasets is required") unless defined?(Datasets::CLDRPlurals)
318
+ end
319
+
317
320
  def run_msginit(pot_header_options={})
318
321
  create_pot_file("test.pot", pot_header_options)
319
322
  po_file_path = "output.po"
@@ -327,5 +330,81 @@ EOF
327
330
  run_msginit(:have_plural_forms => false))
328
331
  end
329
332
  end
333
+
334
+ def test_ja
335
+ assert_equal("nplurals=1; plural=0;",
336
+ @msginit.__send__(:plural_forms, "ja"))
337
+ end
338
+
339
+ def test_en
340
+ assert_equal("nplurals=2; plural=n != 1;",
341
+ @msginit.__send__(:plural_forms, "en"))
342
+ end
343
+
344
+ def test_fr
345
+ assert_equal("nplurals=2; plural=n > 1;",
346
+ @msginit.__send__(:plural_forms, "fr"))
347
+ end
348
+
349
+ def test_lv
350
+ assert_equal("nplurals=3; " +
351
+ "plural=((n % 10) == 1) && ((n % 100) != 11) ? 0 : " +
352
+ "((n % 10) == 0) || ((n % 100) >= 11 && (n % 100) <= 19) " +
353
+ "? 1 : 2;",
354
+ @msginit.__send__(:plural_forms, "lv"))
355
+ end
356
+
357
+ def test_ga
358
+ assert_equal("nplurals=5; " +
359
+ "plural=(n == 1) ? 0 : (n == 2) ? 1 : " +
360
+ "(n >= 3 && n <= 6) ? 2 : (n >= 7 && n <= 10) ? 3 : 4;",
361
+ @msginit.__send__(:plural_forms, "ga"))
362
+ end
363
+
364
+ def test_ro
365
+ assert_equal("nplurals=3; " +
366
+ "plural=(n == 1) ? 0 : " +
367
+ "(n == 0) || ((n % 100) >= 2 && (n % 100) <= 19) ? 1 : 2;",
368
+ @msginit.__send__(:plural_forms, "ro"))
369
+ end
370
+
371
+ def test_lt
372
+ assert_equal("nplurals=3; " +
373
+ "plural=((n % 10) == 1) && " +
374
+ "((n % 100) < 11 || (n % 100) > 19) ? 0 : " +
375
+ "((n % 10) >= 2 && (n % 10) <= 9) && " +
376
+ "((n % 100) < 11 || (n % 100) > 19) ? 1 : 2;",
377
+ @msginit.__send__(:plural_forms, "lt"))
378
+ end
379
+
380
+ def test_ru
381
+ assert_equal("nplurals=3; " +
382
+ "plural=((n % 10) == 1) && ((n % 100) != 11) ? 0 : " +
383
+ "((n % 10) >= 2 && (n % 10) <= 4) && " +
384
+ "((n % 100) < 12 || (n % 100) > 14) ? 1 : 2;",
385
+ @msginit.__send__(:plural_forms, "ru"))
386
+ end
387
+
388
+ def test_cs
389
+ assert_equal("nplurals=3; " +
390
+ "plural=(n == 1) ? 0 : (n >= 2 && n <= 4) ? 1 : 2;",
391
+ @msginit.__send__(:plural_forms, "cs"))
392
+ end
393
+
394
+ def test_pl
395
+ assert_equal("nplurals=3; " +
396
+ "plural=(n == 1) ? 0 : " +
397
+ "((n % 10) >= 2 && (n % 10) <= 4) && " +
398
+ "((n % 100) < 12 || (n % 100) > 14) ? 1 : 2;",
399
+ @msginit.__send__(:plural_forms, "pl"))
400
+ end
401
+
402
+ def test_sl
403
+ assert_equal("nplurals=4; " +
404
+ "plural=((n % 100) == 1) ? 0 : " +
405
+ "((n % 100) == 2) ? 1 : " +
406
+ "((n % 100) >= 3 && (n % 100) <= 4) ? 2 : 3;",
407
+ @msginit.__send__(:plural_forms, "sl"))
408
+ end
330
409
  end
331
410
  end
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.3.7
4
+ version: 3.4.1
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: 2021-01-17 00:00:00.000000000 Z
12
+ date: 2021-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: locale
@@ -40,7 +40,7 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.3.0
42
42
  - !ruby/object:Gem::Dependency
43
- name: rake
43
+ name: kramdown
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
@@ -68,7 +68,7 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: yard
71
+ name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: kramdown
85
+ name: red-datasets
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -123,6 +123,20 @@ dependencies:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: yard
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
126
140
  description: |
127
141
  Gettext is a GNU gettext-like program for Ruby.
128
142
  The catalog file(po-file) is same format with GNU gettext.
@@ -1519,7 +1533,8 @@ files:
1519
1533
  - test/fixtures/erb/ascii.rxml
1520
1534
  - test/fixtures/erb/minus.rhtml
1521
1535
  - test/fixtures/erb/non_ascii.rhtml
1522
- - test/fixtures/gladeparser.glade
1536
+ - test/fixtures/glade/2.glade
1537
+ - test/fixtures/glade/3.glade
1523
1538
  - test/fixtures/gtk_builder_ui_definitions.ui
1524
1539
  - test/fixtures/gtk_builder_ui_definitions.ui~
1525
1540
  - test/fixtures/hello.rb
@@ -1530,15 +1545,16 @@ files:
1530
1545
  - test/fixtures/ns_.rb
1531
1546
  - test/fixtures/ns_/custom.rb
1532
1547
  - test/fixtures/p_.rb
1533
- - test/fixtures/ruby/percent_I.rb
1534
- - test/fixtures/ruby/percent_W.rb
1535
- - test/fixtures/ruby/percent_i.rb
1536
- - test/fixtures/ruby/percent_w.rb
1548
+ - test/fixtures/ruby/percent_lower_i.rb
1549
+ - test/fixtures/ruby/percent_lower_w.rb
1550
+ - test/fixtures/ruby/percent_upper_i.rb
1551
+ - test/fixtures/ruby/percent_upper_w.rb
1537
1552
  - test/fixtures/s_.rb
1538
1553
  - test/fixtures/s_/custom.rb
1539
1554
  - test/fixtures/simple.rb
1540
1555
  - test/fixtures/untranslated.rb
1541
1556
  - test/fixtures/upper_n_.rb
1557
+ - test/fixtures/upper_nn_.rb
1542
1558
  - test/helper.rb
1543
1559
  - test/locale/cr/LC_MESSAGES/plural.mo
1544
1560
  - test/locale/da/LC_MESSAGES/plural.mo
@@ -1650,6 +1666,7 @@ files:
1650
1666
  - test/tools/files/simple_2.po
1651
1667
  - test/tools/files/simple_translation.rb
1652
1668
  - test/tools/files/version.po
1669
+ - test/tools/parser/test_glade.rb
1653
1670
  - test/tools/parser/test_gtk_builder_ui_definitions.rb
1654
1671
  - test/tools/parser/test_ruby.rb
1655
1672
  - test/tools/test.pot
@@ -1660,7 +1677,8 @@ files:
1660
1677
  - test/tools/test_xgettext.rb
1661
1678
  homepage: https://ruby-gettext.github.io/
1662
1679
  licenses:
1663
- - Ruby or LGPLv3+
1680
+ - Ruby
1681
+ - LGPL-3.0+
1664
1682
  metadata: {}
1665
1683
  post_install_message:
1666
1684
  rdoc_options: []