gettext 3.3.3 → 3.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -0
  3. data/doc/text/news.md +231 -0
  4. data/gettext.gemspec +1 -1
  5. data/lib/gettext/locale_path.rb +12 -8
  6. data/lib/gettext/mo.rb +7 -5
  7. data/lib/gettext/tools/msginit.rb +216 -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 +50 -29
  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/_/pipe.rb +32 -0
  94. data/test/fixtures/erb/minus.rhtml +12 -0
  95. data/test/fixtures/{gladeparser.glade → glade/2.glade} +0 -0
  96. data/test/fixtures/glade/3.glade +63 -0
  97. data/test/fixtures/gtk_builder_ui_definitions.ui~ +68 -0
  98. data/test/fixtures/multi_text_domain.rb +12 -12
  99. data/test/fixtures/np_.rb +1 -1
  100. data/test/fixtures/ns_.rb +1 -1
  101. data/test/fixtures/p_.rb +1 -1
  102. data/test/fixtures/ruby/percent_lower_i.rb +1 -0
  103. data/test/fixtures/ruby/percent_lower_w.rb +1 -0
  104. data/test/fixtures/ruby/percent_upper_i.rb +1 -0
  105. data/test/fixtures/ruby/percent_upper_w.rb +1 -0
  106. data/test/fixtures/s_.rb +1 -1
  107. data/test/fixtures/simple.rb +1 -1
  108. data/test/fixtures/upper_nn_.rb +77 -0
  109. data/test/po/_.pot +20 -4
  110. data/test/po/ja/_.edit.po +24 -0
  111. data/test/po/np_.pot +8 -5
  112. data/test/po/ns_.pot +6 -4
  113. data/test/po/p_.pot +3 -3
  114. data/test/po/s_.pot +6 -4
  115. data/test/run-test.rb +0 -1
  116. data/test/test_parser.rb +42 -17
  117. data/test/tools/parser/test_glade.rb +91 -0
  118. data/test/tools/parser/test_gtk_builder_ui_definitions.rb +19 -1
  119. data/test/tools/parser/test_ruby.rb +42 -0
  120. data/test/tools/test_msginit.rb +77 -3
  121. data/test/tools/test_msgmerge.rb +34 -0
  122. metadata +37 -28
@@ -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>
File without changes
@@ -0,0 +1,63 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.38.2 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.24"/>
5
+ <object class="GtkWindow">
6
+ <property name="can-focus">False</property>
7
+ <child>
8
+ <object class="GtkBox">
9
+ <property name="visible">True</property>
10
+ <property name="can-focus">False</property>
11
+ <property name="orientation">vertical</property>
12
+ <child>
13
+ <object class="GtkLabel">
14
+ <property name="visible">True</property>
15
+ <property name="can-focus">False</property>
16
+ <property name="label">untranslatable label</property>
17
+ </object>
18
+ <packing>
19
+ <property name="expand">False</property>
20
+ <property name="fill">True</property>
21
+ <property name="position">0</property>
22
+ </packing>
23
+ </child>
24
+ <child>
25
+ <object class="GtkLabel">
26
+ <property name="visible">True</property>
27
+ <property name="can-focus">False</property>
28
+ <property name="label" translatable="yes" comments="comment for translator">label with comment</property>
29
+ </object>
30
+ <packing>
31
+ <property name="expand">False</property>
32
+ <property name="fill">True</property>
33
+ <property name="position">1</property>
34
+ </packing>
35
+ </child>
36
+ <child>
37
+ <object class="GtkLabel">
38
+ <property name="visible">True</property>
39
+ <property name="can-focus">False</property>
40
+ <property name="label" translatable="yes">label without comment</property>
41
+ </object>
42
+ <packing>
43
+ <property name="expand">False</property>
44
+ <property name="fill">True</property>
45
+ <property name="position">2</property>
46
+ </packing>
47
+ </child>
48
+ <child>
49
+ <object class="GtkLabel">
50
+ <property name="visible">True</property>
51
+ <property name="can-focus">False</property>
52
+ <property name="label" translatable="yes" context="context">label with context</property>
53
+ </object>
54
+ <packing>
55
+ <property name="expand">False</property>
56
+ <property name="fill">True</property>
57
+ <property name="position">3</property>
58
+ </packing>
59
+ </child>
60
+ </object>
61
+ </child>
62
+ </object>
63
+ </interface>
@@ -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>
@@ -4,8 +4,8 @@ module MultiTextDomain
4
4
  class C11
5
5
  include GetText
6
6
  def initialize
7
- bindtextdomain("test1", :path => "locale")
8
- bindtextdomain("test2", :path => "locale")
7
+ bindtextdomain("test1", :path => Helper::Path.locale_path)
8
+ bindtextdomain("test2", :path => Helper::Path.locale_path)
9
9
  end
10
10
  def test
11
11
  _("language")
@@ -17,8 +17,8 @@ module MultiTextDomain
17
17
 
18
18
  class C12
19
19
  include GetText
20
- bindtextdomain("test1", :path => "locale")
21
- bindtextdomain("test2", :path => "locale")
20
+ bindtextdomain("test1", :path => Helper::Path.locale_path)
21
+ bindtextdomain("test2", :path => Helper::Path.locale_path)
22
22
 
23
23
  def test
24
24
  _("language")
@@ -36,7 +36,7 @@ module MultiTextDomain
36
36
 
37
37
  module M1
38
38
  include GetText
39
- bindtextdomain("test1", :path => "locale")
39
+ bindtextdomain("test1", :path => Helper::Path.locale_path)
40
40
 
41
41
  module_function
42
42
  def test
@@ -57,7 +57,7 @@ module MultiTextDomain
57
57
 
58
58
  class M1C1
59
59
  include GetText
60
- bindtextdomain("test2", :path => "locale")
60
+ bindtextdomain("test2", :path => Helper::Path.locale_path)
61
61
  def test
62
62
  _("language")
63
63
  end
@@ -69,7 +69,7 @@ module MultiTextDomain
69
69
  class M1C2
70
70
  include GetText
71
71
  def initialize
72
- bindtextdomain("test2", :path => "locale")
72
+ bindtextdomain("test2", :path => Helper::Path.locale_path)
73
73
  end
74
74
  def test
75
75
  _("language")
@@ -84,7 +84,7 @@ module MultiTextDomain
84
84
  class C2
85
85
  include GetText
86
86
  def initialize
87
- bindtextdomain("test1", :path => "locale")
87
+ bindtextdomain("test1", :path => Helper::Path.locale_path)
88
88
  end
89
89
 
90
90
  def test
@@ -98,7 +98,7 @@ module MultiTextDomain
98
98
 
99
99
  class C3
100
100
  include GetText
101
- bindtextdomain("test1", :path => "locale")
101
+ bindtextdomain("test1", :path => Helper::Path.locale_path)
102
102
 
103
103
  def test
104
104
  _("language")
@@ -110,7 +110,7 @@ module MultiTextDomain
110
110
  end
111
111
 
112
112
  class C4 < C3
113
- bindtextdomain("test2", :path => "locale")
113
+ bindtextdomain("test2", :path => Helper::Path.locale_path)
114
114
 
115
115
  def test2
116
116
  _("LANGUAGE")
@@ -123,13 +123,13 @@ module MultiTextDomain
123
123
 
124
124
  class C51
125
125
  include GetText
126
- bindtextdomain("test3", :path => "locale")
126
+ bindtextdomain("test3", :path => Helper::Path.locale_path)
127
127
  def test
128
128
  _("language")
129
129
  end
130
130
  end
131
131
 
132
132
  class C52 < C12
133
- bindtextdomain("test3", :path => "locale")
133
+ bindtextdomain("test3", :path => Helper::Path.locale_path)
134
134
  end
135
135
  end
data/test/fixtures/np_.rb CHANGED
@@ -22,7 +22,7 @@ require 'gettext'
22
22
 
23
23
  class TestNPGetText
24
24
  include GetText
25
- bindtextdomain("np_", :path => "locale")
25
+ bindtextdomain("np_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def test_1
28
28
  [np_("Magazine", "a book", "%{num} books", 1),
data/test/fixtures/ns_.rb CHANGED
@@ -22,7 +22,7 @@ require 'gettext'
22
22
 
23
23
  class TestNSGetText
24
24
  include GetText
25
- bindtextdomain("ns_", :path => "locale")
25
+ bindtextdomain("ns_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def test_1
28
28
  [ns_("AAA|BBB", "CCC", 1), ns_("AAA|BBB", "CCC", 2)]
data/test/fixtures/p_.rb CHANGED
@@ -23,7 +23,7 @@ require 'gettext'
23
23
 
24
24
  class TestPGetText
25
25
  include GetText
26
- bindtextdomain("p_", :path => "locale")
26
+ bindtextdomain("p_", :path => Helper::Path.locale_path)
27
27
 
28
28
  def test_1
29
29
  p_("AAA", "BBB")
@@ -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)
data/test/fixtures/s_.rb CHANGED
@@ -22,7 +22,7 @@ require 'gettext'
22
22
 
23
23
  class TestSGetText
24
24
  include GetText
25
- bindtextdomain("s_", :path => "locale")
25
+ bindtextdomain("s_", :path => Helper::Path.locale_path)
26
26
 
27
27
  def test_1
28
28
  s_("AAA|BBB")
@@ -4,7 +4,7 @@ require 'gettext'
4
4
 
5
5
  class Simple
6
6
  include GetText
7
- bindtextdomain("test1", :path => "locale")
7
+ bindtextdomain("test1", :path => Helper::Path.locale_path)
8
8
 
9
9
  def test
10
10
  _("language")
@@ -0,0 +1,77 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'gettext'
4
+ include GetText
5
+
6
+ class TestRubyParser_Nn
7
+ bindtextdomain("testNn_rubyparser", :path => "locale")
8
+
9
+ def testNn_1
10
+ Nn_("aaa", "aaas")
11
+ end
12
+
13
+ def testNn_2
14
+ Nn_("aaa\n", "aaas\n")
15
+ end
16
+
17
+ def testNn_3
18
+ Nn_("bbb\nccc", "bbbs\ncccs")
19
+ end
20
+
21
+ def testNn_4
22
+ Nn_("bbb
23
+ ccc
24
+ ddd
25
+ ",
26
+ "bbbs
27
+ cccs
28
+ ddds
29
+ ")
30
+ end
31
+
32
+ def testNn_5
33
+ Nn_("eee", "eees")
34
+ end
35
+
36
+ def testNn_6
37
+ Nn_("eee", "eees") + "foo" + Nn_("fff", "fffs")
38
+ end
39
+
40
+ def testNn_7
41
+ Nn_("ggg"\
42
+ "hhh"\
43
+ "iii",
44
+ "gggs"\
45
+ "hhhs"\
46
+ "iiis")
47
+ end
48
+
49
+ def testNn_8
50
+ Nn_('a"b"c"', 'as"bs"cs"')
51
+ end
52
+
53
+ def testNn_9
54
+ Nn_("d\"e\"f\"", "ds\"es\"fs\"")
55
+ end
56
+
57
+ def testNn_10
58
+ Nn_("jjj", "jjjs") +
59
+ Nn_("kkk", "kkks")
60
+ end
61
+
62
+ def testNn_11
63
+ Nn_("lll" + "mmm", "llls" + "mmms")
64
+ end
65
+
66
+ def testNn_12
67
+ puts Nn_(msg, msgs), "ppp" #Ignored
68
+ end
69
+
70
+ def testNn_13
71
+ Nn_("nnn\n" +
72
+ "ooo",
73
+ "nnns\n" +
74
+ "ooos")
75
+ end
76
+ end
77
+
data/test/po/_.pot CHANGED
@@ -6,10 +6,10 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: _ 3.3.2\n"
9
+ "Project-Id-Version: _ 3.3.8\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2020-01-12 15:00+0900\n"
12
- "PO-Revision-Date: 2020-01-12 15:00+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"
@@ -165,6 +165,22 @@ msgid ""
165
165
  "one new line\n"
166
166
  msgstr ""
167
167
 
168
- #: ../fixtures/_/percent_strings.rb:34
168
+ #: ../fixtures/_/percent_strings.rb:31
169
+ msgid "in_symbol_array"
170
+ msgstr ""
171
+
172
+ #: ../fixtures/_/percent_strings.rb:39
169
173
  msgid "hello world"
170
174
  msgstr ""
175
+
176
+ #: ../fixtures/_/percent_strings.rb:47
177
+ msgid "in_string_array"
178
+ msgstr ""
179
+
180
+ #: ../fixtures/_/pipe.rb:26
181
+ msgid "Hello"
182
+ msgstr ""
183
+
184
+ #: ../fixtures/_/pipe.rb:28
185
+ msgid "World"
186
+ msgstr ""
data/test/po/ja/_.edit.po CHANGED
@@ -93,6 +93,10 @@ msgid ""
93
93
  "Here document2\n"
94
94
  msgstr ""
95
95
 
96
+ #: ../fixtures/_.rb:109
97
+ msgid "in_quote"
98
+ msgstr ""
99
+
96
100
  #. TRANSLATORS: This is a proper name. See the gettext
97
101
  #. manual, section Names. Note this is actually a non-ASCII
98
102
  #. name: The first name is (with Unicode escapes)
@@ -160,3 +164,23 @@ msgstr "ONE LINE"
160
164
  msgid ""
161
165
  "one new line\n"
162
166
  msgstr ""
167
+
168
+ #: ../fixtures/_/percent_strings.rb:31
169
+ msgid "in_symbol_array"
170
+ msgstr ""
171
+
172
+ #: ../fixtures/_/percent_strings.rb:39
173
+ msgid "hello world"
174
+ msgstr ""
175
+
176
+ #: ../fixtures/_/percent_strings.rb:47
177
+ msgid "in_string_array"
178
+ msgstr ""
179
+
180
+ #: ../fixtures/_/pipe.rb:26
181
+ msgid "Hello"
182
+ msgstr ""
183
+
184
+ #: ../fixtures/_/pipe.rb:28
185
+ msgid "World"
186
+ msgstr ""