gettext 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/doc/text/news.md +23 -0
  3. data/lib/gettext/tools/msginit.rb +5 -4
  4. data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +129 -0
  5. data/lib/gettext/tools/parser/ruby.rb +48 -22
  6. data/lib/gettext/tools/xgettext.rb +6 -6
  7. data/lib/gettext/version.rb +1 -1
  8. data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
  9. data/po/bg/gettext.edit.po +12 -4
  10. data/po/bg/gettext.po +7 -3
  11. data/po/bs/gettext.edit.po +12 -4
  12. data/po/bs/gettext.po +7 -3
  13. data/po/ca/gettext.edit.po +12 -4
  14. data/po/ca/gettext.po +7 -3
  15. data/po/cs/gettext.edit.po +12 -4
  16. data/po/cs/gettext.po +7 -3
  17. data/po/de/gettext.edit.po +12 -4
  18. data/po/de/gettext.po +7 -3
  19. data/po/el/gettext.edit.po +12 -4
  20. data/po/el/gettext.po +7 -3
  21. data/po/eo/gettext.edit.po +12 -4
  22. data/po/eo/gettext.po +7 -3
  23. data/po/es/gettext.edit.po +12 -4
  24. data/po/es/gettext.po +7 -3
  25. data/po/et/gettext.edit.po +12 -4
  26. data/po/et/gettext.po +7 -3
  27. data/po/fr/gettext.edit.po +12 -4
  28. data/po/fr/gettext.po +7 -3
  29. data/po/gettext.pot +15 -9
  30. data/po/hr/gettext.edit.po +12 -4
  31. data/po/hr/gettext.po +7 -3
  32. data/po/hu/gettext.edit.po +12 -4
  33. data/po/hu/gettext.po +7 -3
  34. data/po/it/gettext.edit.po +12 -4
  35. data/po/it/gettext.po +7 -3
  36. data/po/ja/gettext.edit.po +14 -6
  37. data/po/ja/gettext.po +9 -5
  38. data/po/ko/gettext.edit.po +12 -4
  39. data/po/ko/gettext.po +7 -3
  40. data/po/lv/gettext.edit.po +12 -4
  41. data/po/lv/gettext.po +7 -3
  42. data/po/nb/gettext.edit.po +12 -4
  43. data/po/nb/gettext.po +7 -3
  44. data/po/nl/gettext.edit.po +12 -4
  45. data/po/nl/gettext.po +7 -3
  46. data/po/pt_BR/gettext.edit.po +12 -4
  47. data/po/pt_BR/gettext.po +7 -3
  48. data/po/ru/gettext.edit.po +12 -4
  49. data/po/ru/gettext.po +7 -3
  50. data/po/sr/gettext.edit.po +12 -4
  51. data/po/sr/gettext.po +7 -3
  52. data/po/sv/gettext.edit.po +12 -4
  53. data/po/sv/gettext.po +7 -3
  54. data/po/uk/gettext.edit.po +12 -4
  55. data/po/uk/gettext.po +7 -3
  56. data/po/vi/gettext.edit.po +12 -4
  57. data/po/vi/gettext.po +7 -3
  58. data/po/zh/gettext.edit.po +12 -4
  59. data/po/zh/gettext.po +7 -3
  60. data/po/zh_TW/gettext.edit.po +12 -4
  61. data/po/zh_TW/gettext.po +7 -3
  62. data/samples/cgi/po/helloerb1.pot +3 -3
  63. data/samples/cgi/po/helloerb2.pot +3 -3
  64. data/samples/cgi/po/hellolib.pot +3 -3
  65. data/samples/cgi/po/main.pot +3 -3
  66. data/samples/po/hello.pot +3 -3
  67. data/samples/po/hello2.pot +4 -4
  68. data/samples/po/hello_glade2.pot +4 -4
  69. data/samples/po/hello_gtk2.pot +4 -4
  70. data/samples/po/hello_gtk_builder.pot +5 -4
  71. data/samples/po/hello_noop.pot +4 -4
  72. data/samples/po/hello_plural.pot +4 -4
  73. data/samples/po/hello_tk.pot +4 -4
  74. data/test/fixtures/_/backtick.rb +30 -0
  75. data/test/fixtures/_/block_parameter.rb +2 -2
  76. data/test/fixtures/_/double_quote_in_double_quote.rb +2 -2
  77. data/test/fixtures/_/double_quote_in_single_quote.rb +2 -2
  78. data/test/fixtures/_/literal_concatenation_with_continuation_line.rb +2 -2
  79. data/test/fixtures/_/middle_new_line.rb +2 -2
  80. data/test/fixtures/_/multiple_lines_literal.rb +2 -2
  81. data/test/fixtures/_/multiple_messages_in_same_line.rb +2 -2
  82. data/test/fixtures/_/multiple_same_messages.rb +2 -2
  83. data/test/fixtures/_/one_line.rb +2 -2
  84. data/test/fixtures/_/one_new_line.rb +2 -2
  85. data/test/{gettext-test-utils.rb → fixtures/_/percent_strings.rb} +21 -26
  86. data/test/fixtures/_/quoted_symbol.rb +34 -0
  87. data/test/fixtures/gtk_builder_ui_definitions.ui +68 -0
  88. data/test/fixtures/ns_/custom.rb +2 -2
  89. data/test/fixtures/s_/custom.rb +2 -2
  90. data/test/helper.rb +99 -0
  91. data/test/po/_.pot +2 -6
  92. data/test/po/backslash.pot +4 -6
  93. data/test/po/hello.pot +3 -3
  94. data/test/po/ja/_.edit.po +0 -4
  95. data/test/po/ja/hello.edit.po +1 -0
  96. data/test/po/non_ascii.pot +4 -4
  97. data/test/po/np_.pot +5 -8
  98. data/test/po/ns_.pot +4 -6
  99. data/test/po/p_.pot +3 -3
  100. data/test/po/s_.pot +4 -6
  101. data/test/po/untranslated.pot +4 -4
  102. data/test/run-test.rb +2 -2
  103. data/test/test_parser.rb +11 -10
  104. data/test/test_po_parser.rb +2 -2
  105. data/test/test_string.rb +1 -1
  106. data/test/tools/parser/test_gtk_builder_ui_definitions.rb +45 -0
  107. data/test/tools/parser/test_ruby.rb +26 -39
  108. data/test/tools/test_msgmerge.rb +3 -3
  109. data/test/tools/test_xgettext.rb +2 -2
  110. metadata +20 -14
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class MultipleLinesLiteral
23
23
  include GetText
24
24
 
25
- bindtextdomain("_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  _("multiple
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class MultipleMessagesInSameLine
23
23
  include GetText
24
24
 
25
- bindtextdomain("_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  _("multiple") + " messages " + _("in same line")
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class MultipleSameMessages
23
23
  include GetText
24
24
 
25
- bindtextdomain("_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  _("multiple same messages")
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class OneLine
23
23
  include GetText
24
24
 
25
- bindtextdomain("_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  _("one line")
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class OneNewLine
23
23
  include GetText
24
24
 
25
- bindtextdomain("_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  _("one new line\n")
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2020 Kitaiti Makoto <KitaitiMakoto@gmail.com>
2
2
  #
3
3
  # License: Ruby's or LGPL
4
4
  #
@@ -15,37 +15,32 @@
15
15
  # You should have received a copy of the GNU Lesser General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
- require "fileutils"
19
- require "tmpdir"
20
- require "tempfile"
21
- require "time"
18
+ module Fixtures
19
+ module Method_
20
+ class PercentStrings
21
+ include GetText
22
22
 
23
- require "gettext"
23
+ bindtextdomain("_", :path => Helper::Path.locale_path)
24
24
 
25
- module GetTextTestUtils
26
- module_function
27
- def fixture_path(*components)
28
- File.join(File.dirname(__FILE__), "fixtures", *components)
29
- end
25
+ def symbol_array
26
+ _(%i(hello world))
27
+ end
30
28
 
31
- def locale_path
32
- File.join(File.dirname(__FILE__), "locale")
33
- end
29
+ def symbol
30
+ _(%s(hello world))
31
+ end
34
32
 
35
- def setup_tmpdir
36
- @tmpdir = Dir.mktmpdir
37
- end
33
+ def string
34
+ _(%(hello world))
35
+ end
38
36
 
39
- def teardown_tmpdir
40
- FileUtils.rm_rf(@tmpdir, :secure => true) if @tmpdir
41
- end
37
+ def string_array
38
+ _(%w(hello world))
39
+ end
42
40
 
43
- def suppress_warning
44
- stderr, $stderr = $stderr, StringIO.new
45
- begin
46
- yield
47
- ensure
48
- $stderr = stderr
41
+ def execute
42
+ _(%x(echo hello world))
43
+ end
49
44
  end
50
45
  end
51
46
  end
@@ -0,0 +1,34 @@
1
+ # Copyright (C) 2020 Kitaiti Makoto <KitaitiMakoto@gmail.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 QuotedSymbol
21
+ include GetText
22
+
23
+ bindtextdomain("_", :path => Helper::Path.locale_path)
24
+
25
+ def symbol_quoted_by_single_quote
26
+ _(:'hello world')
27
+ end
28
+
29
+ def symbol_quoted_by_double_quote
30
+ _(:"hello world")
31
+ end
32
+ end
33
+ end
34
+ end
@@ -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>
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class Custom
23
23
  include GetText
24
24
 
25
- bindtextdomain("ns_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("ns_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  ns_("context|context$message", "context|context$messages", 1, "$")
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # License: Ruby's or LGPL
6
6
  #
@@ -22,7 +22,7 @@ module Fixtures
22
22
  class Custom
23
23
  include GetText
24
24
 
25
- bindtextdomain("s_", :path => GetTextTestUtils.locale_path)
25
+ bindtextdomain("s_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def message
28
28
  s_("context|context$message", "$")
data/test/helper.rb ADDED
@@ -0,0 +1,99 @@
1
+ # Copyright (C) 2012-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
+ require "fileutils"
19
+ require "tmpdir"
20
+ require "tempfile"
21
+ require "time"
22
+
23
+ require "gettext"
24
+
25
+ module Helper
26
+ module Path
27
+ module_function
28
+ def fixture_path(*components)
29
+ File.join(File.dirname(__FILE__), "fixtures", *components)
30
+ end
31
+
32
+ def locale_path
33
+ File.join(File.dirname(__FILE__), "locale")
34
+ end
35
+ end
36
+
37
+ module Tmpdir
38
+ def setup_tmpdir
39
+ @tmpdir = Dir.mktmpdir
40
+ end
41
+
42
+ def teardown_tmpdir
43
+ FileUtils.rm_rf(@tmpdir, :secure => true) if @tmpdir
44
+ end
45
+ end
46
+
47
+ module Warning
48
+ def suppress_warning
49
+ stderr, $stderr = $stderr, StringIO.new
50
+ begin
51
+ yield
52
+ ensure
53
+ $stderr = stderr
54
+ end
55
+ end
56
+ end
57
+
58
+ module Parser
59
+ include Helper::Path
60
+
61
+ def assert_parse(expected, file)
62
+ assert_equal(normalize_expected(expected),
63
+ normalize_actual(parse(file)))
64
+ end
65
+
66
+ def normalize_expected(messages)
67
+ messages.collect do |message|
68
+ default = {
69
+ :msgid => nil,
70
+ :msgid_plural => nil,
71
+ :msgctxt => nil,
72
+ :msgstr => nil,
73
+ :separator => nil,
74
+ :references => nil,
75
+ }
76
+ default.merge(message)
77
+ end
78
+ end
79
+
80
+ def normalize_actual(po)
81
+ po.collect do |po_entry|
82
+ {
83
+ :msgid => po_entry.msgid,
84
+ :msgid_plural => po_entry.msgid_plural,
85
+ :msgctxt => po_entry.msgctxt,
86
+ :msgstr => po_entry.msgstr,
87
+ :separator => po_entry.separator,
88
+ :references => normalize_references(po_entry.references),
89
+ }
90
+ end
91
+ end
92
+
93
+ def normalize_references(references)
94
+ references.collect do |reference|
95
+ reference.sub(/\A#{Regexp.escape(fixture_path)}\//, "")
96
+ end
97
+ end
98
+ end
99
+ end
data/test/po/_.pot CHANGED
@@ -8,8 +8,8 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: _ 3.2.9\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2020-01-08 16:55+0900\n"
12
- "PO-Revision-Date: 2020-01-08 16:55+0900\n"
11
+ "POT-Creation-Date: 2018-06-17 07:35+0900\n"
12
+ "PO-Revision-Date: 2018-06-17 07:35+0900\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
@@ -92,10 +92,6 @@ msgid ""
92
92
  "Here document2\n"
93
93
  msgstr ""
94
94
 
95
- #: ../fixtures/_.rb:109
96
- msgid "in_quote"
97
- msgstr ""
98
-
99
95
  #. TRANSLATORS: This is a proper name. See the gettext
100
96
  #. manual, section Names. Note this is actually a non-ASCII
101
97
  #. name: The first name is (with Unicode escapes)
@@ -1,18 +1,16 @@
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 backslash package.
3
+ # This file is distributed under the same license as the PACKAGE package.
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: backslash 3.2.9\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2018-06-16 12:12+0900\n"
12
- "PO-Revision-Date: 2018-06-16 12:12+0900\n"
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "POT-Creation-Date: 2012-08-19 22:58+0900\n"
11
+ "PO-Revision-Date: 2012-08-19 22:58+0900\n"
13
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "Language: \n"
16
14
  "MIME-Version: 1.0\n"
17
15
  "Content-Type: text/plain; charset=UTF-8\n"
18
16
  "Content-Transfer-Encoding: 8bit\n"
data/test/po/hello.pot CHANGED
@@ -6,10 +6,10 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: hello 3.2.9\n"
9
+ "Project-Id-Version: hello 3.1.7\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2018-06-16 12:12+0900\n"
12
- "PO-Revision-Date: 2018-06-16 12:12+0900\n"
11
+ "POT-Creation-Date: 2015-09-22 14:05+0900\n"
12
+ "PO-Revision-Date: 2015-09-22 14:05+0900\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"