gettext 3.3.2 → 3.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/doc/text/news.md +217 -0
  3. data/gettext.gemspec +0 -1
  4. data/lib/gettext/locale_path.rb +12 -8
  5. data/lib/gettext/tools/msgmerge.rb +13 -0
  6. data/lib/gettext/tools/parser/erb.rb +9 -1
  7. data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +0 -3
  8. data/lib/gettext/tools/parser/ruby.rb +50 -23
  9. data/lib/gettext/version.rb +1 -1
  10. data/po/bg/gettext.edit.po +33 -25
  11. data/po/bg/gettext.po +9 -3
  12. data/po/bs/gettext.edit.po +33 -25
  13. data/po/bs/gettext.po +9 -3
  14. data/po/ca/gettext.edit.po +33 -25
  15. data/po/ca/gettext.po +9 -3
  16. data/po/cs/gettext.edit.po +33 -25
  17. data/po/cs/gettext.po +9 -3
  18. data/po/de/gettext.edit.po +33 -25
  19. data/po/de/gettext.po +9 -3
  20. data/po/el/gettext.edit.po +33 -25
  21. data/po/el/gettext.po +9 -3
  22. data/po/eo/gettext.edit.po +33 -25
  23. data/po/eo/gettext.po +9 -3
  24. data/po/es/gettext.edit.po +33 -25
  25. data/po/es/gettext.po +9 -3
  26. data/po/et/gettext.edit.po +33 -25
  27. data/po/et/gettext.po +9 -3
  28. data/po/fr/gettext.edit.po +33 -25
  29. data/po/fr/gettext.po +9 -3
  30. data/po/gettext.pot +36 -28
  31. data/po/hr/gettext.edit.po +33 -25
  32. data/po/hr/gettext.po +9 -3
  33. data/po/hu/gettext.edit.po +33 -25
  34. data/po/hu/gettext.po +9 -3
  35. data/po/it/gettext.edit.po +33 -25
  36. data/po/it/gettext.po +9 -3
  37. data/po/ja/gettext.edit.po +33 -25
  38. data/po/ja/gettext.po +9 -3
  39. data/po/ko/gettext.edit.po +33 -25
  40. data/po/ko/gettext.po +9 -3
  41. data/po/lv/gettext.edit.po +33 -25
  42. data/po/lv/gettext.po +9 -3
  43. data/po/nb/gettext.edit.po +33 -25
  44. data/po/nb/gettext.po +9 -3
  45. data/po/nl/gettext.edit.po +33 -25
  46. data/po/nl/gettext.po +9 -3
  47. data/po/pt_BR/gettext.edit.po +33 -25
  48. data/po/pt_BR/gettext.po +9 -3
  49. data/po/ru/gettext.edit.po +33 -25
  50. data/po/ru/gettext.po +9 -3
  51. data/po/sr/gettext.edit.po +33 -25
  52. data/po/sr/gettext.po +9 -3
  53. data/po/sv/gettext.edit.po +33 -25
  54. data/po/sv/gettext.po +9 -3
  55. data/po/uk/gettext.edit.po +33 -25
  56. data/po/uk/gettext.po +9 -3
  57. data/po/vi/gettext.edit.po +33 -25
  58. data/po/vi/gettext.po +9 -3
  59. data/po/zh/gettext.edit.po +33 -25
  60. data/po/zh/gettext.po +9 -3
  61. data/po/zh_TW/gettext.edit.po +33 -25
  62. data/po/zh_TW/gettext.po +9 -3
  63. data/test/fixtures/_/percent_strings.rb +9 -0
  64. data/test/fixtures/_/pipe.rb +32 -0
  65. data/test/fixtures/erb/minus.rhtml +12 -0
  66. data/test/fixtures/gtk_builder_ui_definitions.ui~ +68 -0
  67. data/test/fixtures/ruby/percent_I.rb +1 -0
  68. data/test/fixtures/ruby/percent_W.rb +1 -0
  69. data/test/fixtures/ruby/percent_i.rb +1 -0
  70. data/test/fixtures/ruby/percent_w.rb +1 -0
  71. data/test/run-test.rb +0 -1
  72. data/test/test_parser.rb +7 -0
  73. data/test/tools/parser/test_ruby.rb +52 -2
  74. data/test/tools/test_msgmerge.rb +34 -0
  75. metadata +21 -29
@@ -456,9 +456,18 @@ msgid ""
456
456
  "one new line\n"
457
457
  msgstr ""
458
458
 
459
+ msgid "in_symbol_array"
460
+ msgstr ""
461
+
459
462
  msgid "hello world"
460
463
  msgstr ""
461
464
 
465
+ msgid "in_string_array"
466
+ msgstr ""
467
+
468
+ msgid "Hello"
469
+ msgstr ""
470
+
462
471
  msgid "You should escape '\\' as '\\\\'."
463
472
  msgstr ""
464
473
 
@@ -485,9 +494,6 @@ msgstr ""
485
494
  msgid "duplicated"
486
495
  msgstr ""
487
496
 
488
- msgid "Hello"
489
- msgstr ""
490
-
491
497
  msgid ""
492
498
  "bbb\n"
493
499
  msgid_plural ""
@@ -1,4 +1,5 @@
1
1
  # Copyright (C) 2020 Kitaiti Makoto <KitaitiMakoto@gmail.com>
2
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
2
3
  #
3
4
  # License: Ruby's or LGPL
4
5
  #
@@ -26,6 +27,10 @@ module Fixtures
26
27
  _(%i(hello world))
27
28
  end
28
29
 
30
+ def in_symbol_array
31
+ %I(before#{_("in_symbol_array")}after)
32
+ end
33
+
29
34
  def symbol
30
35
  _(%s(hello world))
31
36
  end
@@ -38,6 +43,10 @@ module Fixtures
38
43
  _(%w(hello world))
39
44
  end
40
45
 
46
+ def in_string_array
47
+ %W(before#{_("in_string_array")}after)
48
+ end
49
+
41
50
  def execute
42
51
  _(%x(echo hello world))
43
52
  end
@@ -0,0 +1,32 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # License: Ruby's or LGPL
4
+ #
5
+ # This library is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Lesser General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module Fixtures
19
+ module Method_
20
+ class Pipe
21
+ include GetText
22
+
23
+ bindtextdomain("_", :path => Helper::Path.locale_path)
24
+
25
+ def binary_pipe
26
+ _("Hello")
27
+ 1 | 2
28
+ _("World")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,12 @@
1
+ <%
2
+ require 'gettext'
3
+ include GetText
4
+ bindtextdomain("helloerb", :path => "locale")
5
+ %>
6
+ <html>
7
+ <head>
8
+ <title><%= _("Hello") -%></title>
9
+ </head>
10
+ <body>
11
+ </body>
12
+ </html>
@@ -0,0 +1,68 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.22.1 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.20"/>
5
+ <object class="GtkWindow">
6
+ <property name="can_focus">False</property>
7
+ <child>
8
+ <placeholder/>
9
+ </child>
10
+ <child>
11
+ <object class="GtkBox">
12
+ <property name="visible">True</property>
13
+ <property name="can_focus">False</property>
14
+ <property name="orientation">vertical</property>
15
+ <child>
16
+ <object class="GtkLabel">
17
+ <property name="visible">True</property>
18
+ <property name="can_focus">False</property>
19
+ <property name="label" translatable="yes" context="context" comments="comment">label with context</property>
20
+ </object>
21
+ <packing>
22
+ <property name="expand">False</property>
23
+ <property name="fill">True</property>
24
+ <property name="position">0</property>
25
+ </packing>
26
+ </child>
27
+ <child>
28
+ <object class="GtkLabel">
29
+ <property name="visible">True</property>
30
+ <property name="can_focus">False</property>
31
+ <property name="label" translatable="yes">label simple</property>
32
+ </object>
33
+ <packing>
34
+ <property name="expand">False</property>
35
+ <property name="fill">True</property>
36
+ <property name="position">1</property>
37
+ </packing>
38
+ </child>
39
+ <child>
40
+ <object class="GtkLabel">
41
+ <property name="visible">True</property>
42
+ <property name="can_focus">False</property>
43
+ <property name="label">not trnanslatable label</property>
44
+ </object>
45
+ <packing>
46
+ <property name="expand">False</property>
47
+ <property name="fill">True</property>
48
+ <property name="position">2</property>
49
+ </packing>
50
+ </child>
51
+ <child>
52
+ <object class="GtkLabel">
53
+ <property name="visible">True</property>
54
+ <property name="can_focus">False</property>
55
+ <property name="label" translatable="yes">multiple
56
+ lines
57
+ label</property>
58
+ </object>
59
+ <packing>
60
+ <property name="expand">False</property>
61
+ <property name="fill">True</property>
62
+ <property name="position">3</property>
63
+ </packing>
64
+ </child>
65
+ </object>
66
+ </child>
67
+ </object>
68
+ </interface>
@@ -0,0 +1 @@
1
+ %I(hello world)
@@ -0,0 +1 @@
1
+ %W(Hello World)
@@ -0,0 +1 @@
1
+ %i(hello world)
@@ -0,0 +1 @@
1
+ %w(Hello World)
@@ -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"
@@ -190,6 +190,13 @@ class TestGetTextParser < Test::Unit::TestCase
190
190
 
191
191
  assert_target('わたし', ["#{path}:12"])
192
192
  end
193
+
194
+ def test_minus
195
+ path = fixture_path("erb", "minus.rhtml")
196
+ @ary = GetText::ErbParser.parse(path)
197
+
198
+ assert_target("Hello", ["#{path}:8"])
199
+ end
193
200
  end
194
201
 
195
202
  def test_xgettext_parse
@@ -194,10 +194,18 @@ class TestRubyParser < Test::Unit::TestCase
194
194
  def test_percent_strings
195
195
  path = "percent_strings.rb"
196
196
  assert_parse([
197
+ {
198
+ :msgid => "in_symbol_array",
199
+ :references => ["#{path}:31"],
200
+ },
197
201
  {
198
202
  :msgid => "hello world",
199
- :references => ["#{path}:34"],
200
- }
203
+ :references => ["#{path}:39"],
204
+ },
205
+ {
206
+ :msgid => "in_string_array",
207
+ :references => ["#{path}:47"],
208
+ },
201
209
  ],
202
210
  path)
203
211
  end
@@ -214,6 +222,21 @@ class TestRubyParser < Test::Unit::TestCase
214
222
  path)
215
223
  end
216
224
 
225
+ def test_pipe
226
+ path = "pipe.rb"
227
+ assert_parse([
228
+ {
229
+ :msgid => "Hello",
230
+ :references => ["#{path}:26"],
231
+ },
232
+ {
233
+ :msgid => "World",
234
+ :references => ["#{path}:28"],
235
+ },
236
+ ],
237
+ path)
238
+ end
239
+
217
240
  private
218
241
  def fixture_path(*components)
219
242
  super("_", *components)
@@ -258,4 +281,31 @@ class TestRubyParser < Test::Unit::TestCase
258
281
  super("ns_", *components)
259
282
  end
260
283
  end
284
+
285
+ sub_test_case("parse") do
286
+ def test_percent_w
287
+ assert_parse([],
288
+ "percent_w.rb")
289
+ end
290
+
291
+ def test_percent_W
292
+ assert_parse([],
293
+ "percent_W.rb")
294
+ end
295
+
296
+ def test_percent_i
297
+ assert_parse([],
298
+ "percent_i.rb")
299
+ end
300
+
301
+ def test_percent_I
302
+ assert_parse([],
303
+ "percent_I.rb")
304
+ end
305
+
306
+ private
307
+ def fixture_path(*components)
308
+ super("ruby", *components)
309
+ end
310
+ end
261
311
  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
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.2
4
+ version: 3.3.7
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: 2020-01-12 00:00:00.000000000 Z
12
+ date: 2021-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: locale
@@ -109,20 +109,6 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: test-unit-notify
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
112
  - !ruby/object:Gem::Dependency
127
113
  name: test-unit-rr
128
114
  requirement: !ruby/object:Gem::Requirement
@@ -145,11 +131,11 @@ email:
145
131
  - kou@clear-code.com
146
132
  - mutomasa at gmail.com
147
133
  executables:
148
- - rmsgmerge
149
- - rmsginit
150
134
  - rmsgcat
151
- - rxgettext
152
135
  - rmsgfmt
136
+ - rmsginit
137
+ - rmsgmerge
138
+ - rxgettext
153
139
  extensions: []
154
140
  extra_rdoc_files: []
155
141
  files:
@@ -1526,13 +1512,16 @@ files:
1526
1512
  - test/fixtures/_/one_line.rb
1527
1513
  - test/fixtures/_/one_new_line.rb
1528
1514
  - test/fixtures/_/percent_strings.rb
1515
+ - test/fixtures/_/pipe.rb
1529
1516
  - test/fixtures/_/quoted_symbol.rb
1530
1517
  - test/fixtures/backslash.rb
1531
1518
  - test/fixtures/erb/ascii.rhtml
1532
1519
  - test/fixtures/erb/ascii.rxml
1520
+ - test/fixtures/erb/minus.rhtml
1533
1521
  - test/fixtures/erb/non_ascii.rhtml
1534
1522
  - test/fixtures/gladeparser.glade
1535
1523
  - test/fixtures/gtk_builder_ui_definitions.ui
1524
+ - test/fixtures/gtk_builder_ui_definitions.ui~
1536
1525
  - test/fixtures/hello.rb
1537
1526
  - test/fixtures/lower_n_.rb
1538
1527
  - test/fixtures/multi_text_domain.rb
@@ -1541,6 +1530,10 @@ files:
1541
1530
  - test/fixtures/ns_.rb
1542
1531
  - test/fixtures/ns_/custom.rb
1543
1532
  - 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
1544
1537
  - test/fixtures/s_.rb
1545
1538
  - test/fixtures/s_/custom.rb
1546
1539
  - test/fixtures/simple.rb
@@ -1684,23 +1677,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1684
1677
  - !ruby/object:Gem::Version
1685
1678
  version: '0'
1686
1679
  requirements: []
1687
- rubyforge_project:
1688
- rubygems_version: 2.7.6.2
1680
+ rubygems_version: 3.3.0.dev
1689
1681
  signing_key:
1690
1682
  specification_version: 4
1691
1683
  summary: Gettext is a pure Ruby libary and tools to localize messages.
1692
1684
  test_files:
1685
+ - test/test_class_info.rb
1686
+ - test/test_gettext.rb
1687
+ - test/test_locale_path.rb
1693
1688
  - test/test_mo.rb
1694
1689
  - test/test_parser.rb
1690
+ - test/test_po.rb
1691
+ - test/test_po_entry.rb
1695
1692
  - test/test_po_parser.rb
1696
- - test/test_text_domain_bind.rb
1697
- - test/test_text_domain.rb
1698
1693
  - test/test_string.rb
1699
- - test/test_locale_path.rb
1700
- - test/test_thread.rb
1701
- - test/test_class_info.rb
1694
+ - test/test_text_domain.rb
1695
+ - test/test_text_domain_bind.rb
1702
1696
  - test/test_text_domain_multi.rb
1703
- - test/test_po_entry.rb
1704
- - test/test_gettext.rb
1705
1697
  - test/test_text_domain_toplevel.rb
1706
- - test/test_po.rb
1698
+ - test/test_thread.rb