gettext 3.3.5 → 3.3.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 (121) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -0
  3. data/doc/text/news.md +220 -0
  4. data/gettext.gemspec +4 -4
  5. data/lib/gettext/locale_path.rb +12 -8
  6. data/lib/gettext/mo.rb +7 -5
  7. data/lib/gettext/tools/msginit.rb +221 -50
  8. data/lib/gettext/tools/msgmerge.rb +13 -0
  9. data/lib/gettext/tools/parser/erb.rb +9 -1
  10. data/lib/gettext/tools/parser/glade.rb +38 -40
  11. data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +6 -6
  12. data/lib/gettext/tools/parser/ruby.rb +2 -2
  13. data/lib/gettext/version.rb +2 -2
  14. data/locale/bg/LC_MESSAGES/gettext.mo +0 -0
  15. data/locale/bs/LC_MESSAGES/gettext.mo +0 -0
  16. data/locale/ca/LC_MESSAGES/gettext.mo +0 -0
  17. data/locale/cs/LC_MESSAGES/gettext.mo +0 -0
  18. data/locale/de/LC_MESSAGES/gettext.mo +0 -0
  19. data/locale/el/LC_MESSAGES/gettext.mo +0 -0
  20. data/locale/eo/LC_MESSAGES/gettext.mo +0 -0
  21. data/locale/es/LC_MESSAGES/gettext.mo +0 -0
  22. data/locale/et/LC_MESSAGES/gettext.mo +0 -0
  23. data/locale/fr/LC_MESSAGES/gettext.mo +0 -0
  24. data/locale/hr/LC_MESSAGES/gettext.mo +0 -0
  25. data/locale/hu/LC_MESSAGES/gettext.mo +0 -0
  26. data/locale/it/LC_MESSAGES/gettext.mo +0 -0
  27. data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
  28. data/locale/ko/LC_MESSAGES/gettext.mo +0 -0
  29. data/locale/lv/LC_MESSAGES/gettext.mo +0 -0
  30. data/locale/nb/LC_MESSAGES/gettext.mo +0 -0
  31. data/locale/nl/LC_MESSAGES/gettext.mo +0 -0
  32. data/locale/pt_BR/LC_MESSAGES/gettext.mo +0 -0
  33. data/locale/ru/LC_MESSAGES/gettext.mo +0 -0
  34. data/locale/sr/LC_MESSAGES/gettext.mo +0 -0
  35. data/locale/uk/LC_MESSAGES/gettext.mo +0 -0
  36. data/locale/vi/LC_MESSAGES/gettext.mo +0 -0
  37. data/locale/zh/LC_MESSAGES/gettext.mo +0 -0
  38. data/locale/zh_TW/LC_MESSAGES/gettext.mo +0 -0
  39. data/po/bg/gettext.edit.po +36 -554
  40. data/po/bg/gettext.po +0 -423
  41. data/po/bs/gettext.edit.po +36 -554
  42. data/po/bs/gettext.po +0 -423
  43. data/po/ca/gettext.edit.po +36 -554
  44. data/po/ca/gettext.po +0 -423
  45. data/po/cs/gettext.edit.po +36 -554
  46. data/po/cs/gettext.po +0 -423
  47. data/po/de/gettext.edit.po +36 -554
  48. data/po/de/gettext.po +0 -423
  49. data/po/el/gettext.edit.po +36 -554
  50. data/po/el/gettext.po +0 -423
  51. data/po/eo/gettext.edit.po +36 -554
  52. data/po/eo/gettext.po +0 -423
  53. data/po/es/gettext.edit.po +36 -554
  54. data/po/es/gettext.po +0 -423
  55. data/po/et/gettext.edit.po +36 -554
  56. data/po/et/gettext.po +0 -423
  57. data/po/fr/gettext.edit.po +36 -554
  58. data/po/fr/gettext.po +0 -423
  59. data/po/gettext.pot +37 -619
  60. data/po/hr/gettext.edit.po +36 -554
  61. data/po/hr/gettext.po +0 -423
  62. data/po/hu/gettext.edit.po +36 -554
  63. data/po/hu/gettext.po +0 -423
  64. data/po/it/gettext.edit.po +36 -554
  65. data/po/it/gettext.po +0 -423
  66. data/po/ja/gettext.edit.po +36 -554
  67. data/po/ja/gettext.po +0 -423
  68. data/po/ko/gettext.edit.po +36 -554
  69. data/po/ko/gettext.po +0 -423
  70. data/po/lv/gettext.edit.po +36 -554
  71. data/po/lv/gettext.po +0 -423
  72. data/po/nb/gettext.edit.po +36 -554
  73. data/po/nb/gettext.po +0 -423
  74. data/po/nl/gettext.edit.po +36 -554
  75. data/po/nl/gettext.po +0 -423
  76. data/po/pt_BR/gettext.edit.po +36 -554
  77. data/po/pt_BR/gettext.po +0 -423
  78. data/po/ru/gettext.edit.po +36 -554
  79. data/po/ru/gettext.po +0 -423
  80. data/po/sr/gettext.edit.po +36 -554
  81. data/po/sr/gettext.po +0 -423
  82. data/po/sv/gettext.edit.po +34 -555
  83. data/po/sv/gettext.po +0 -423
  84. data/po/uk/gettext.edit.po +36 -554
  85. data/po/uk/gettext.po +0 -423
  86. data/po/vi/gettext.edit.po +36 -554
  87. data/po/vi/gettext.po +0 -423
  88. data/po/zh/gettext.edit.po +36 -554
  89. data/po/zh/gettext.po +0 -423
  90. data/po/zh_TW/gettext.edit.po +36 -554
  91. data/po/zh_TW/gettext.po +0 -423
  92. data/test/fixtures/_.rb +1 -1
  93. data/test/fixtures/erb/minus.rhtml +12 -0
  94. data/test/fixtures/{gladeparser.glade → glade/2.glade} +0 -0
  95. data/test/fixtures/glade/3.glade +63 -0
  96. data/test/fixtures/gtk_builder_ui_definitions.ui~ +68 -0
  97. data/test/fixtures/multi_text_domain.rb +12 -12
  98. data/test/fixtures/np_.rb +1 -1
  99. data/test/fixtures/ns_.rb +1 -1
  100. data/test/fixtures/p_.rb +1 -1
  101. data/test/fixtures/ruby/{percent_i.rb → percent_lower_i.rb} +0 -0
  102. data/test/fixtures/ruby/{percent_w.rb → percent_lower_w.rb} +0 -0
  103. data/test/fixtures/ruby/{percent_I.rb → percent_upper_i.rb} +0 -0
  104. data/test/fixtures/ruby/{percent_W.rb → percent_upper_w.rb} +0 -0
  105. data/test/fixtures/s_.rb +1 -1
  106. data/test/fixtures/simple.rb +1 -1
  107. data/test/fixtures/upper_nn_.rb +77 -0
  108. data/test/po/_.pot +20 -4
  109. data/test/po/ja/_.edit.po +24 -0
  110. data/test/po/np_.pot +8 -5
  111. data/test/po/ns_.pot +6 -4
  112. data/test/po/p_.pot +3 -3
  113. data/test/po/s_.pot +6 -4
  114. data/test/run-test.rb +0 -1
  115. data/test/test_parser.rb +42 -17
  116. data/test/tools/parser/test_glade.rb +91 -0
  117. data/test/tools/parser/test_gtk_builder_ui_definitions.rb +19 -1
  118. data/test/tools/parser/test_ruby.rb +4 -4
  119. data/test/tools/test_msginit.rb +77 -3
  120. data/test/tools/test_msgmerge.rb +34 -0
  121. metadata +29 -25
data/test/po/ns_.pot CHANGED
@@ -1,16 +1,18 @@
1
1
  # SOME DESCRIPTIVE TITLE.
2
2
  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
3
+ # This file is distributed under the same license as the ns_ package.
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: PACKAGE VERSION\n"
10
- "POT-Creation-Date: 2012-08-19 22:38+0900\n"
11
- "PO-Revision-Date: 2012-08-19 22:38+0900\n"
9
+ "Project-Id-Version: ns_ 3.3.8\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2021-06-09 11:31+0900\n"
12
+ "PO-Revision-Date: 2021-06-09 11:31+0900\n"
12
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "Language: \n"
14
16
  "MIME-Version: 1.0\n"
15
17
  "Content-Type: text/plain; charset=UTF-8\n"
16
18
  "Content-Transfer-Encoding: 8bit\n"
data/test/po/p_.pot CHANGED
@@ -6,10 +6,10 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: p_ 3.1.3\n"
9
+ "Project-Id-Version: p_ 3.3.8\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2014-07-09 15:25+0900\n"
12
- "PO-Revision-Date: 2014-07-09 15:25+0900\n"
11
+ "POT-Creation-Date: 2021-06-09 11:31+0900\n"
12
+ "PO-Revision-Date: 2021-06-09 11:31+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/test/po/s_.pot CHANGED
@@ -1,16 +1,18 @@
1
1
  # SOME DESCRIPTIVE TITLE.
2
2
  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
3
+ # This file is distributed under the same license as the s_ package.
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: PACKAGE VERSION\n"
10
- "POT-Creation-Date: 2012-08-19 22:25+0900\n"
11
- "PO-Revision-Date: 2012-08-19 22:25+0900\n"
9
+ "Project-Id-Version: s_ 3.3.8\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2021-06-09 11:31+0900\n"
12
+ "PO-Revision-Date: 2021-06-09 11:31+0900\n"
12
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "Language: \n"
14
16
  "MIME-Version: 1.0\n"
15
17
  "Content-Type: text/plain; charset=UTF-8\n"
16
18
  "Content-Transfer-Encoding: 8bit\n"
data/test/run-test.rb CHANGED
@@ -29,7 +29,6 @@ $LOAD_PATH.unshift(lib_dir)
29
29
  $LOAD_PATH.unshift(test_dir)
30
30
 
31
31
  require "test-unit"
32
- require "test/unit/notify"
33
32
  require "test/unit/rr"
34
33
 
35
34
  require "helper"
data/test/test_parser.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
4
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
5
5
  # Copyright (C) 2010 masone (Christian Felder) <ema@rh-productions.ch>
6
6
  # Copyright (C) 2009 Vladimir Dobriakov <vladimir@geekq.net>
7
7
  # Copyright (C) 2009-2010 Masao Mutoh
@@ -23,7 +23,6 @@
23
23
 
24
24
  require "tempfile"
25
25
  require "gettext/tools/parser/ruby"
26
- require "gettext/tools/parser/glade"
27
26
  require "gettext/tools/parser/erb"
28
27
 
29
28
  require "gettext/tools/xgettext"
@@ -97,6 +96,40 @@ class TestGetTextParser < Test::Unit::TestCase
97
96
  ['fixtures/upper_n_.rb:64'])
98
97
  end
99
98
 
99
+ def test_Nn_
100
+ @ary = @xgettext.parse(['fixtures/upper_nn_.rb'])
101
+
102
+ assert_plural_target('aaa', 'aaas',
103
+ ['fixtures/upper_nn_.rb:10'])
104
+ assert_plural_target("aaa\n", "aaas\n",
105
+ ['fixtures/upper_nn_.rb:14'])
106
+ assert_plural_target("bbb\nccc", "bbbs\ncccs",
107
+ ['fixtures/upper_nn_.rb:18'])
108
+ assert_plural_target("bbb\nccc\nddd\n", "bbbs\ncccs\nddds\n",
109
+ ['fixtures/upper_nn_.rb:22'])
110
+ assert_plural_target('eee', 'eees',
111
+ [
112
+ 'fixtures/upper_nn_.rb:33',
113
+ 'fixtures/upper_nn_.rb:37',
114
+ ])
115
+ assert_plural_target('fff', 'fffs',
116
+ ['fixtures/upper_nn_.rb:37'])
117
+ assert_plural_target('ggghhhiii', 'gggshhhsiiis',
118
+ ['fixtures/upper_nn_.rb:41'])
119
+ assert_plural_target('a"b"c"', 'as"bs"cs"',
120
+ ['fixtures/upper_nn_.rb:50'])
121
+ assert_plural_target('d"e"f"', 'ds"es"fs"',
122
+ ['fixtures/upper_nn_.rb:54'])
123
+ assert_plural_target('jjj', 'jjjs',
124
+ ['fixtures/upper_nn_.rb:58'])
125
+ assert_plural_target('kkk', 'kkks',
126
+ ['fixtures/upper_nn_.rb:59'])
127
+ assert_plural_target('lllmmm', 'lllsmmms',
128
+ ['fixtures/upper_nn_.rb:63'])
129
+ assert_plural_target("nnn\nooo", "nnns\nooos",
130
+ ['fixtures/upper_nn_.rb:71'])
131
+ end
132
+
100
133
  def test_n_
101
134
  @xgettext.parse_options[:comment_tag] = "TRANSLATORS:"
102
135
  @ary = @xgettext.parse(['fixtures/lower_n_.rb'])
@@ -144,21 +177,6 @@ class TestGetTextParser < Test::Unit::TestCase
144
177
  end
145
178
  end
146
179
 
147
- class TestGlade < self
148
- def test_old_style
149
- # Old style (~2.0.4)
150
- ary = GetText::GladeParser.parse('fixtures/gladeparser.glade')
151
-
152
- assert_equal(['window1', 'fixtures/gladeparser.glade:8'], ary[0])
153
- assert_equal(['normal text', 'fixtures/gladeparser.glade:29'], ary[1])
154
- assert_equal(['1st line\n2nd line\n3rd line', 'fixtures/gladeparser.glade:50'], ary[2])
155
- assert_equal(['<span color="red" weight="bold" size="large">markup </span>', 'fixtures/gladeparser.glade:73'], ary[3])
156
- assert_equal(['<span color="red">1st line markup </span>\n<span color="blue">2nd line markup</span>', 'fixtures/gladeparser.glade:94'], ary[4])
157
- assert_equal(['<span>&quot;markup&quot; with &lt;escaped strings&gt;</span>', 'fixtures/gladeparser.glade:116'], ary[5])
158
- assert_equal(['duplicated', 'fixtures/gladeparser.glade:137', 'fixtures/gladeparser.glade:158'], ary[6])
159
- end
160
- end
161
-
162
180
  class TestErbParser < self
163
181
  include Helper::Path
164
182
 
@@ -190,6 +208,13 @@ class TestGetTextParser < Test::Unit::TestCase
190
208
 
191
209
  assert_target('わたし', ["#{path}:12"])
192
210
  end
211
+
212
+ def test_minus
213
+ path = fixture_path("erb", "minus.rhtml")
214
+ @ary = GetText::ErbParser.parse(path)
215
+
216
+ assert_target("Hello", ["#{path}:8"])
217
+ end
193
218
  end
194
219
 
195
220
  def test_xgettext_parse
@@ -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
@@ -784,6 +784,40 @@ msgstr ""
784
784
  end
785
785
  end
786
786
 
787
+ class TestWarning < self
788
+ def pot_content
789
+ <<-POT
790
+ msgid "Hello"
791
+ msgstr ""
792
+ POT
793
+ end
794
+
795
+ def po_content
796
+ <<-PO
797
+ #, fuzzy
798
+ msgid "Hello!"
799
+ msgstr "Bonjour!"
800
+ PO
801
+ end
802
+
803
+ def test_default
804
+ _stdout, stderr = capture_output do
805
+ @msgmerge.run(@po_file_path, @pot_file_path)
806
+ end
807
+ assert_equal(<<-STDERR, stderr)
808
+ Warning: fuzzy message was used.
809
+ #{@po_file_path}: msgid 'Hello!'
810
+ STDERR
811
+ end
812
+
813
+ def test_no_report_warning
814
+ _stdout, stderr = capture_output do
815
+ @msgmerge.run("--no-report-warning", @po_file_path, @pot_file_path)
816
+ end
817
+ assert_equal("", stderr)
818
+ end
819
+ end
820
+
787
821
  class TestObsoleteEntries < self
788
822
  def pot_content
789
823
  <<-POT