gettext 3.3.7 → 3.3.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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -0
  3. data/doc/text/news.md +25 -0
  4. data/gettext.gemspec +1 -0
  5. data/lib/gettext/mo.rb +7 -5
  6. data/lib/gettext/tools/msginit.rb +216 -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 +77 -3
  114. metadata +24 -7
@@ -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
  #
@@ -327,5 +325,81 @@ EOF
327
325
  run_msginit(:have_plural_forms => false))
328
326
  end
329
327
  end
328
+
329
+ def test_ja
330
+ assert_equal("nplurals=1; plural=0;",
331
+ @msginit.__send__(:plural_forms, "ja"))
332
+ end
333
+
334
+ def test_en
335
+ assert_equal("nplurals=2; plural=n != 1;",
336
+ @msginit.__send__(:plural_forms, "en"))
337
+ end
338
+
339
+ def test_fr
340
+ assert_equal("nplurals=2; plural=n > 1;",
341
+ @msginit.__send__(:plural_forms, "fr"))
342
+ end
343
+
344
+ def test_lv
345
+ assert_equal("nplurals=3; " +
346
+ "plural=((n % 10) == 1) && ((n % 100) != 11) ? 0 : " +
347
+ "((n % 10) == 0) || ((n % 100) >= 11 && (n % 100) <= 19) " +
348
+ "? 1 : 2;",
349
+ @msginit.__send__(:plural_forms, "lv"))
350
+ end
351
+
352
+ def test_ga
353
+ assert_equal("nplurals=5; " +
354
+ "plural=(n == 1) ? 0 : (n == 2) ? 1 : " +
355
+ "(n >= 3 && n <= 6) ? 2 : (n >= 7 && n <= 10) ? 3 : 4;",
356
+ @msginit.__send__(:plural_forms, "ga"))
357
+ end
358
+
359
+ def test_ro
360
+ assert_equal("nplurals=3; " +
361
+ "plural=(n == 1) ? 0 : " +
362
+ "(n == 0) || ((n % 100) >= 2 && (n % 100) <= 19) ? 1 : 2;",
363
+ @msginit.__send__(:plural_forms, "ro"))
364
+ end
365
+
366
+ def test_lt
367
+ assert_equal("nplurals=3; " +
368
+ "plural=((n % 10) == 1) && " +
369
+ "((n % 100) < 11 || (n % 100) > 19) ? 0 : " +
370
+ "((n % 10) >= 2 && (n % 10) <= 9) && " +
371
+ "((n % 100) < 11 || (n % 100) > 19) ? 1 : 2;",
372
+ @msginit.__send__(:plural_forms, "lt"))
373
+ end
374
+
375
+ def test_ru
376
+ assert_equal("nplurals=3; " +
377
+ "plural=((n % 10) == 1) && ((n % 100) != 11) ? 0 : " +
378
+ "((n % 10) >= 2 && (n % 10) <= 4) && " +
379
+ "((n % 100) < 12 || (n % 100) > 14) ? 1 : 2;",
380
+ @msginit.__send__(:plural_forms, "ru"))
381
+ end
382
+
383
+ def test_cs
384
+ assert_equal("nplurals=3; " +
385
+ "plural=(n == 1) ? 0 : (n >= 2 && n <= 4) ? 1 : 2;",
386
+ @msginit.__send__(:plural_forms, "cs"))
387
+ end
388
+
389
+ def test_pl
390
+ assert_equal("nplurals=3; " +
391
+ "plural=(n == 1) ? 0 : " +
392
+ "((n % 10) >= 2 && (n % 10) <= 4) && " +
393
+ "((n % 100) < 12 || (n % 100) > 14) ? 1 : 2;",
394
+ @msginit.__send__(:plural_forms, "pl"))
395
+ end
396
+
397
+ def test_sl
398
+ assert_equal("nplurals=4; " +
399
+ "plural=((n % 100) == 1) ? 0 : " +
400
+ "((n % 100) == 2) ? 1 : " +
401
+ "((n % 100) >= 3 && (n % 100) <= 4) ? 2 : 3;",
402
+ @msginit.__send__(:plural_forms, "sl"))
403
+ end
330
404
  end
331
405
  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.3.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: 2021-01-17 00:00:00.000000000 Z
12
+ date: 2021-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: locale
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 2.0.5
28
+ - !ruby/object:Gem::Dependency
29
+ name: red-datasets
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: text
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -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