gettext 3.2.9 → 3.4.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 (237) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +276 -198
  3. data/Rakefile +7 -4
  4. data/doc/text/news.md +451 -0
  5. data/gettext.gemspec +10 -7
  6. data/lib/gettext/locale_path.rb +17 -9
  7. data/lib/gettext/mo.rb +12 -19
  8. data/lib/gettext/po.rb +4 -4
  9. data/lib/gettext/po_entry.rb +47 -27
  10. data/lib/gettext/po_parser.rb +65 -59
  11. data/lib/gettext/text_domain.rb +1 -1
  12. data/lib/gettext/text_domain_manager.rb +6 -5
  13. data/lib/gettext/tools/msgcat.rb +9 -2
  14. data/lib/gettext/tools/msginit.rb +226 -54
  15. data/lib/gettext/tools/msgmerge.rb +24 -6
  16. data/lib/gettext/tools/parser/erb.rb +9 -1
  17. data/lib/gettext/tools/parser/erubi.rb +88 -0
  18. data/lib/gettext/tools/parser/glade.rb +38 -40
  19. data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +129 -0
  20. data/lib/gettext/tools/parser/ruby.rb +288 -221
  21. data/lib/gettext/tools/task.rb +4 -5
  22. data/lib/gettext/tools/xgettext.rb +21 -10
  23. data/lib/gettext/version.rb +3 -3
  24. data/locale/bg/LC_MESSAGES/gettext.mo +0 -0
  25. data/locale/bs/LC_MESSAGES/gettext.mo +0 -0
  26. data/locale/ca/LC_MESSAGES/gettext.mo +0 -0
  27. data/locale/cs/LC_MESSAGES/gettext.mo +0 -0
  28. data/locale/de/LC_MESSAGES/gettext.mo +0 -0
  29. data/locale/el/LC_MESSAGES/gettext.mo +0 -0
  30. data/locale/eo/LC_MESSAGES/gettext.mo +0 -0
  31. data/locale/es/LC_MESSAGES/gettext.mo +0 -0
  32. data/locale/et/LC_MESSAGES/gettext.mo +0 -0
  33. data/locale/fr/LC_MESSAGES/gettext.mo +0 -0
  34. data/locale/hr/LC_MESSAGES/gettext.mo +0 -0
  35. data/locale/hu/LC_MESSAGES/gettext.mo +0 -0
  36. data/locale/it/LC_MESSAGES/gettext.mo +0 -0
  37. data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
  38. data/locale/ko/LC_MESSAGES/gettext.mo +0 -0
  39. data/locale/lv/LC_MESSAGES/gettext.mo +0 -0
  40. data/locale/nb/LC_MESSAGES/gettext.mo +0 -0
  41. data/locale/nl/LC_MESSAGES/gettext.mo +0 -0
  42. data/locale/pt_BR/LC_MESSAGES/gettext.mo +0 -0
  43. data/locale/ru/LC_MESSAGES/gettext.mo +0 -0
  44. data/locale/sr/LC_MESSAGES/gettext.mo +0 -0
  45. data/locale/uk/LC_MESSAGES/gettext.mo +0 -0
  46. data/locale/vi/LC_MESSAGES/gettext.mo +0 -0
  47. data/locale/zh/LC_MESSAGES/gettext.mo +0 -0
  48. data/locale/zh_TW/LC_MESSAGES/gettext.mo +0 -0
  49. data/po/bg/gettext.edit.po +81 -572
  50. data/po/bg/gettext.po +7 -409
  51. data/po/bs/gettext.edit.po +81 -572
  52. data/po/bs/gettext.po +7 -409
  53. data/po/ca/gettext.edit.po +81 -572
  54. data/po/ca/gettext.po +7 -409
  55. data/po/cs/gettext.edit.po +81 -572
  56. data/po/cs/gettext.po +7 -409
  57. data/po/de/gettext.edit.po +81 -572
  58. data/po/de/gettext.po +7 -409
  59. data/po/el/gettext.edit.po +81 -572
  60. data/po/el/gettext.po +7 -409
  61. data/po/eo/gettext.edit.po +81 -572
  62. data/po/eo/gettext.po +7 -409
  63. data/po/es/gettext.edit.po +81 -572
  64. data/po/es/gettext.po +7 -409
  65. data/po/et/gettext.edit.po +81 -572
  66. data/po/et/gettext.po +7 -409
  67. data/po/fr/gettext.edit.po +81 -572
  68. data/po/fr/gettext.po +7 -409
  69. data/po/gettext.pot +93 -645
  70. data/po/hr/gettext.edit.po +81 -572
  71. data/po/hr/gettext.po +7 -409
  72. data/po/hu/gettext.edit.po +81 -572
  73. data/po/hu/gettext.po +7 -409
  74. data/po/it/gettext.edit.po +81 -572
  75. data/po/it/gettext.po +7 -409
  76. data/po/ja/gettext.edit.po +83 -574
  77. data/po/ja/gettext.po +9 -411
  78. data/po/ko/gettext.edit.po +81 -572
  79. data/po/ko/gettext.po +7 -409
  80. data/po/lv/gettext.edit.po +81 -572
  81. data/po/lv/gettext.po +7 -409
  82. data/po/nb/gettext.edit.po +81 -572
  83. data/po/nb/gettext.po +7 -409
  84. data/po/nl/gettext.edit.po +81 -572
  85. data/po/nl/gettext.po +7 -409
  86. data/po/pt_BR/gettext.edit.po +81 -572
  87. data/po/pt_BR/gettext.po +7 -409
  88. data/po/ru/gettext.edit.po +81 -572
  89. data/po/ru/gettext.po +7 -409
  90. data/po/sr/gettext.edit.po +81 -572
  91. data/po/sr/gettext.po +7 -409
  92. data/po/sv/gettext.edit.po +81 -572
  93. data/po/sv/gettext.po +7 -409
  94. data/po/uk/gettext.edit.po +81 -572
  95. data/po/uk/gettext.po +7 -409
  96. data/po/vi/gettext.edit.po +81 -572
  97. data/po/vi/gettext.po +7 -409
  98. data/po/zh/gettext.edit.po +81 -572
  99. data/po/zh/gettext.po +7 -409
  100. data/po/zh_TW/gettext.edit.po +81 -572
  101. data/po/zh_TW/gettext.po +7 -409
  102. data/samples/cgi/po/helloerb1.pot +3 -3
  103. data/samples/cgi/po/helloerb2.pot +3 -3
  104. data/samples/cgi/po/hellolib.pot +3 -3
  105. data/samples/cgi/po/main.pot +3 -3
  106. data/samples/po/bg/hello_gtk_builder.edit.po +15 -0
  107. data/samples/po/bg/hello_gtk_builder.po +12 -0
  108. data/samples/po/bs/hello_gtk_builder.edit.po +15 -0
  109. data/samples/po/bs/hello_gtk_builder.po +12 -0
  110. data/samples/po/ca/hello_gtk_builder.edit.po +15 -0
  111. data/samples/po/ca/hello_gtk_builder.po +12 -0
  112. data/samples/po/cs/hello_gtk_builder.edit.po +15 -0
  113. data/samples/po/cs/hello_gtk_builder.po +12 -0
  114. data/samples/po/de/hello_gtk_builder.edit.po +15 -0
  115. data/samples/po/de/hello_gtk_builder.po +12 -0
  116. data/samples/po/el/hello_gtk_builder.edit.po +15 -0
  117. data/samples/po/el/hello_gtk_builder.po +12 -0
  118. data/samples/po/eo/hello_gtk_builder.edit.po +15 -0
  119. data/samples/po/eo/hello_gtk_builder.po +12 -0
  120. data/samples/po/es/hello_gtk_builder.edit.po +15 -0
  121. data/samples/po/es/hello_gtk_builder.po +12 -0
  122. data/samples/po/fr/hello_gtk_builder.edit.po +15 -0
  123. data/samples/po/fr/hello_gtk_builder.po +12 -0
  124. data/samples/po/hello.pot +3 -3
  125. data/samples/po/hello2.pot +4 -4
  126. data/samples/po/hello_glade2.pot +8 -5
  127. data/samples/po/hello_gtk2.pot +4 -4
  128. data/samples/po/hello_gtk_builder.pot +18 -4
  129. data/samples/po/hello_noop.pot +4 -4
  130. data/samples/po/hello_plural.pot +4 -4
  131. data/samples/po/hello_tk.pot +4 -4
  132. data/samples/po/hr/hello_gtk_builder.edit.po +15 -0
  133. data/samples/po/hr/hello_gtk_builder.po +12 -0
  134. data/samples/po/hu/hello_gtk_builder.edit.po +15 -0
  135. data/samples/po/hu/hello_gtk_builder.po +12 -0
  136. data/samples/po/it/hello_gtk_builder.edit.po +15 -0
  137. data/samples/po/it/hello_gtk_builder.po +12 -0
  138. data/samples/po/ja/hello_gtk_builder.edit.po +15 -0
  139. data/samples/po/ja/hello_gtk_builder.po +12 -0
  140. data/samples/po/ko/hello_gtk_builder.edit.po +15 -0
  141. data/samples/po/ko/hello_gtk_builder.po +12 -0
  142. data/samples/po/lv/hello_gtk_builder.edit.po +15 -0
  143. data/samples/po/lv/hello_gtk_builder.po +12 -0
  144. data/samples/po/nb/hello_gtk_builder.edit.po +15 -0
  145. data/samples/po/nb/hello_gtk_builder.po +12 -0
  146. data/samples/po/nl/hello_gtk_builder.edit.po +15 -0
  147. data/samples/po/nl/hello_gtk_builder.po +12 -0
  148. data/samples/po/pt_BR/hello_gtk_builder.edit.po +15 -0
  149. data/samples/po/pt_BR/hello_gtk_builder.po +12 -0
  150. data/samples/po/ru/hello_gtk_builder.edit.po +15 -0
  151. data/samples/po/ru/hello_gtk_builder.po +12 -0
  152. data/samples/po/sr/hello_gtk_builder.edit.po +15 -0
  153. data/samples/po/sr/hello_gtk_builder.po +12 -0
  154. data/samples/po/sv/hello_gtk_builder.edit.po +15 -0
  155. data/samples/po/sv/hello_gtk_builder.po +12 -0
  156. data/samples/po/uk/hello_gtk_builder.edit.po +15 -0
  157. data/samples/po/uk/hello_gtk_builder.po +12 -0
  158. data/samples/po/vi/hello_gtk_builder.edit.po +15 -0
  159. data/samples/po/vi/hello_gtk_builder.po +12 -0
  160. data/samples/po/zh/hello_gtk_builder.edit.po +15 -0
  161. data/samples/po/zh/hello_gtk_builder.po +12 -0
  162. data/samples/po/zh_TW/hello_gtk_builder.edit.po +15 -0
  163. data/samples/po/zh_TW/hello_gtk_builder.po +12 -0
  164. data/src/po_parser.ry +48 -42
  165. data/test/fixtures/_/backtick.rb +30 -0
  166. data/test/fixtures/_/block_parameter.rb +2 -2
  167. data/test/fixtures/_/double_quote_in_double_quote.rb +2 -2
  168. data/test/fixtures/_/double_quote_in_single_quote.rb +2 -2
  169. data/test/fixtures/_/literal_concatenation_with_continuation_line.rb +2 -2
  170. data/test/fixtures/_/middle_new_line.rb +2 -2
  171. data/test/fixtures/_/multiple_lines_literal.rb +2 -2
  172. data/test/fixtures/_/multiple_messages_in_same_line.rb +2 -2
  173. data/test/fixtures/_/multiple_same_messages.rb +2 -2
  174. data/test/fixtures/_/one_line.rb +2 -2
  175. data/test/fixtures/_/one_new_line.rb +2 -2
  176. data/test/fixtures/_/percent_strings.rb +55 -0
  177. data/test/fixtures/_/pipe.rb +32 -0
  178. data/test/{gettext-test-utils.rb → fixtures/_/quoted_symbol.rb} +13 -23
  179. data/test/fixtures/_.rb +10 -1
  180. data/test/fixtures/erb/case.rhtml +16 -0
  181. data/test/fixtures/erb/minus.rhtml +12 -0
  182. data/test/fixtures/erb/non_ascii.rhtml +1 -0
  183. data/test/fixtures/glade/3.glade +63 -0
  184. data/test/fixtures/gtk_builder_ui_definitions.ui +68 -0
  185. data/test/fixtures/multi_text_domain.rb +12 -12
  186. data/test/fixtures/np_.rb +1 -1
  187. data/test/fixtures/ns_/custom.rb +2 -2
  188. data/test/fixtures/ns_.rb +1 -1
  189. data/test/fixtures/p_.rb +1 -1
  190. data/test/fixtures/ruby/percent_lower_i.rb +1 -0
  191. data/test/fixtures/ruby/percent_lower_w.rb +1 -0
  192. data/test/fixtures/ruby/percent_upper_i.rb +1 -0
  193. data/test/fixtures/ruby/percent_upper_w.rb +1 -0
  194. data/test/fixtures/s_/custom.rb +2 -2
  195. data/test/fixtures/s_.rb +1 -1
  196. data/test/fixtures/simple.rb +5 -1
  197. data/test/fixtures/upper_nn_.rb +77 -0
  198. data/test/helper.rb +99 -0
  199. data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -0
  200. data/test/locale/fr/LC_MESSAGES/test1.mo +0 -0
  201. data/test/locale/fr_BE/LC_MESSAGES/test1.mo +0 -0
  202. data/test/locale/fr_BE_Foo/LC_MESSAGES/test1.mo +0 -0
  203. data/test/locale/ja/LC_MESSAGES/_.mo +0 -0
  204. data/test/po/_.pot +28 -4
  205. data/test/po/backslash.pot +6 -4
  206. data/test/po/fr/plural_error.po +7 -0
  207. data/test/po/fr/test1.po +7 -0
  208. data/test/po/fr_BE/test1.po +24 -0
  209. data/test/po/fr_BE_Foo/test1.po +20 -0
  210. data/test/po/hello.pot +3 -3
  211. data/test/po/ja/_.edit.po +27 -3
  212. data/test/po/ja/_.po +20 -2
  213. data/test/po/ja/hello.edit.po +0 -1
  214. data/test/po/non_ascii.pot +4 -4
  215. data/test/po/np_.pot +8 -5
  216. data/test/po/ns_.pot +6 -4
  217. data/test/po/p_.pot +3 -3
  218. data/test/po/s_.pot +6 -4
  219. data/test/po/untranslated.pot +4 -4
  220. data/test/run-test.rb +2 -3
  221. data/test/test_class_info.rb +8 -9
  222. data/test/test_gettext.rb +30 -1
  223. data/test/test_locale_path.rb +12 -4
  224. data/test/test_parser.rb +113 -25
  225. data/test/test_po_entry.rb +21 -17
  226. data/test/test_po_parser.rb +49 -4
  227. data/test/test_string.rb +9 -5
  228. data/test/tools/parser/test_glade.rb +91 -0
  229. data/test/tools/parser/test_gtk_builder_ui_definitions.rb +63 -0
  230. data/test/tools/parser/test_ruby.rb +76 -39
  231. data/test/tools/test_msgcat.rb +21 -1
  232. data/test/tools/test_msginit.rb +82 -3
  233. data/test/tools/test_msgmerge.rb +81 -6
  234. data/test/tools/test_xgettext.rb +106 -5
  235. metadata +82 -34
  236. data/lib/gettext/tools/parser/haml.rb +0 -61
  237. /data/test/fixtures/{gladeparser.glade → glade/2.glade} +0 -0
data/test/po/_.pot CHANGED
@@ -6,10 +6,10 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: _ 3.2.2\n"
9
+ "Project-Id-Version: _ 3.4.4\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2017-06-24 12:20+0900\n"
12
- "PO-Revision-Date: 2017-06-24 12:20+0900\n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+0900\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
@@ -83,7 +83,7 @@ msgid "#"
83
83
  msgstr ""
84
84
 
85
85
  #: ../fixtures/_.rb:96
86
- msgid "\\taaa"
86
+ msgid "\\taaa'bbb\\ccc"
87
87
  msgstr ""
88
88
 
89
89
  #: ../fixtures/_.rb:100
@@ -92,6 +92,10 @@ msgid ""
92
92
  "Here document2\n"
93
93
  msgstr ""
94
94
 
95
+ #: ../fixtures/_.rb:109
96
+ msgid "in_quote"
97
+ msgstr ""
98
+
95
99
  #. TRANSLATORS: This is a proper name. See the gettext
96
100
  #. manual, section Names. Note this is actually a non-ASCII
97
101
  #. name: The first name is (with Unicode escapes)
@@ -160,3 +164,23 @@ msgstr ""
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 ""
@@ -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 backslash 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:58+0900\n"
11
- "PO-Revision-Date: 2012-08-19 22:58+0900\n"
9
+ "Project-Id-Version: backslash 3.4.4\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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"
@@ -13,8 +13,15 @@ msgstr ""
13
13
  "MIME-Version: 1.0\n"
14
14
  "Content-Type: text/plain; charset=US-ASCII\n"
15
15
  "Content-Transfer-Encoding: ENCODING\n"
16
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
16
17
 
17
18
  #: hello_plural.rb:11
18
19
  msgid "first"
19
20
  msgid_plural "second"
20
21
  msgstr[0] "fr_first"
22
+
23
+ #: hello_plural.rb:14
24
+ msgid "first_2"
25
+ msgid_plural "second_2"
26
+ msgstr[0] "fr_first_2"
27
+ msgstr[1] ""
data/test/po/fr/test1.po CHANGED
@@ -13,6 +13,7 @@ msgstr ""
13
13
  "MIME-Version: 1.0\n"
14
14
  "Content-Type: text/plain; charset=utf-8\n"
15
15
  "Content-Transfer-Encoding: ENCODING\n"
16
+ "Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"
16
17
 
17
18
  #: simple.rb:10
18
19
  msgid "language"
@@ -21,3 +22,9 @@ msgstr "french"
21
22
  #: simple.rb:14
22
23
  msgid "one is %d."
23
24
  msgstr "FRENCH:ONE IS %d."
25
+
26
+ #: simple.rb:18
27
+ msgid "There is an apple."
28
+ msgid_plural "There are %{num} apples."
29
+ msgstr[0] "FRENCH:Il y a une pomme."
30
+ msgstr[1] "FRENCH:Il y a %{num} pommes."
@@ -0,0 +1,24 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR ORGANIZATION
3
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+ #
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE VERSION\n"
9
+ "POT-Creation-Date: 2002-01-01 02:24:56+0900\n"
10
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
+ "Language-Team: LANGUAGE <LL@li.org>\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=utf-8\n"
15
+ "Content-Transfer-Encoding: ENCODING\n"
16
+ "Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"
17
+
18
+ #: simple.rb:10
19
+ msgid "language"
20
+ msgstr "french-Belgium"
21
+
22
+ #: simple.rb:14
23
+ msgid "one is %d."
24
+ msgstr "FRENCH-BELGIUM:ONE IS %d."
@@ -0,0 +1,20 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR ORGANIZATION
3
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+ #
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE VERSION\n"
9
+ "POT-Creation-Date: 2002-01-01 02:24:56+0900\n"
10
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
+ "Language-Team: LANGUAGE <LL@li.org>\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=utf-8\n"
15
+ "Content-Transfer-Encoding: ENCODING\n"
16
+ "Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"
17
+
18
+ #: simple.rb:10
19
+ msgid "language"
20
+ msgstr "french-Belgium-Foo"
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.1.7\n"
9
+ "Project-Id-Version: hello 3.4.4\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2015-09-22 14:05+0900\n"
12
- "PO-Revision-Date: 2015-09-22 14:05+0900\n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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/ja/_.edit.po CHANGED
@@ -5,7 +5,7 @@
5
5
  msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: PACKAGE VERSION\n"
8
- "PO-Revision-Date: 2013-08-30 23:17+0900\n"
8
+ "PO-Revision-Date: 2023-10-22 06:37+0900\n"
9
9
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
10
10
  "Language-Team: LANGUAGE <LL@li.org>\n"
11
11
  "MIME-Version: 1.0\n"
@@ -84,8 +84,8 @@ msgid "#"
84
84
  msgstr ""
85
85
 
86
86
  #: ../fixtures/_.rb:96
87
- msgid "\taaa"
88
- msgstr ""
87
+ msgid "\\taaa'bbb\\ccc"
88
+ msgstr "AAA"
89
89
 
90
90
  #: ../fixtures/_.rb:100
91
91
  msgid ""
@@ -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 ""
data/test/po/ja/_.po CHANGED
@@ -5,7 +5,7 @@
5
5
  msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: PACKAGE VERSION\n"
8
- "PO-Revision-Date: 2013-08-30 23:17+0900\n"
8
+ "PO-Revision-Date: 2018-06-17 07:37+0900\n"
9
9
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
10
10
  "Language-Team: LANGUAGE <LL@li.org>\n"
11
11
  "MIME-Version: 1.0\n"
@@ -69,7 +69,7 @@ msgstr ""
69
69
  msgid "#"
70
70
  msgstr ""
71
71
 
72
- msgid "\taaa"
72
+ msgid "\taaa'bbb\\ccc"
73
73
  msgstr ""
74
74
 
75
75
  msgid ""
@@ -77,6 +77,9 @@ msgid ""
77
77
  "Here document2\n"
78
78
  msgstr ""
79
79
 
80
+ msgid "in_quote"
81
+ msgstr ""
82
+
80
83
  #. TRANSLATORS: This is a proper name. See the gettext
81
84
  #. manual, section Names. Note this is actually a non-ASCII
82
85
  #. name: The first name is (with Unicode escapes)
@@ -130,3 +133,18 @@ msgstr "ONE LINE"
130
133
  msgid ""
131
134
  "one new line\n"
132
135
  msgstr ""
136
+
137
+ msgid "in_symbol_array"
138
+ msgstr ""
139
+
140
+ msgid "hello world"
141
+ msgstr ""
142
+
143
+ msgid "in_string_array"
144
+ msgstr ""
145
+
146
+ msgid "Hello"
147
+ msgstr ""
148
+
149
+ msgid "World"
150
+ msgstr ""
@@ -7,7 +7,6 @@ msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: hello 3.1.7\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2015-09-22 14:05+0900\n"
11
10
  "PO-Revision-Date: 2015-09-22 14:06+0900\n"
12
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
12
  "Language-Team: Japanese\n"
@@ -1,15 +1,15 @@
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 gettext package.
3
+ # This file is distributed under the same license as the non_ascii package.
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: gettext 3.0.0\n"
9
+ "Project-Id-Version: non_ascii 3.4.4\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2013-08-30 22:00+0900\n"
12
- "PO-Revision-Date: 2013-08-30 22:00+0900\n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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/np_.pot CHANGED
@@ -1,22 +1,25 @@
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 np_ 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:14+0900\n"
11
- "PO-Revision-Date: 2012-08-19 22:14+0900\n"
9
+ "Project-Id-Version: np_ 3.4.4\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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"
17
19
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18
20
 
19
- #: ../fixtures/np_.rb:28 ../fixtures/np_.rb:29 ../fixtures/np_.rb:33 ../fixtures/np_.rb:34
21
+ #: ../fixtures/np_.rb:28 ../fixtures/np_.rb:29 ../fixtures/np_.rb:33
22
+ #: ../fixtures/np_.rb:34
20
23
  msgctxt "Magazine"
21
24
  msgid "a book"
22
25
  msgid_plural "%{num} books"
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.4.4\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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.4.4\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: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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.4.4\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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"
@@ -1,15 +1,15 @@
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 gettext package.
3
+ # This file is distributed under the same license as the untranslated package.
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: gettext 3.0.0\n"
9
+ "Project-Id-Version: untranslated 3.4.4\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2013-08-30 22:00+0900\n"
12
- "PO-Revision-Date: 2013-08-30 22:00+0900\n"
11
+ "POT-Creation-Date: 2023-06-11 06:20+0900\n"
12
+ "PO-Revision-Date: 2023-06-11 06:20+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/run-test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
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
  #
@@ -29,10 +29,9 @@ $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
- require "gettext-test-utils"
34
+ require "helper"
36
35
 
37
36
  Dir.chdir(test_dir) do
38
37
  Dir.glob("**/test_*.rb").each do |test_file_path|
@@ -30,11 +30,6 @@ module M8
30
30
  include M9
31
31
  end
32
32
 
33
- # Anonymous module
34
- @@anon = Module.new
35
- class @@anon::AC1; end
36
- module @@anon::AM1; end
37
-
38
33
  module TestClassInfoSandbox
39
34
  class << self
40
35
  def clear
@@ -57,11 +52,15 @@ class TestClassInfo < Test::Unit::TestCase
57
52
  assert_equal TestClassInfo, normalize_class(self)
58
53
  end
59
54
 
55
+ @@anonymous_module = Module.new
56
+ class @@anonymous_module::AC1; end
57
+ module @@anonymous_module::AM1; end
58
+
60
59
  def test_normalize_class_anonymous_module
61
- assert_equal Object, normalize_class(@@anon)
62
- assert_equal Object, normalize_class(@@anon)
63
- assert_equal Object, normalize_class(@@anon::AC1)
64
- assert_equal Object, normalize_class(@@anon::AM1)
60
+ assert_equal Object, normalize_class(@@anonymous_module)
61
+ assert_equal Object, normalize_class(@@anonymous_module)
62
+ assert_equal Object, normalize_class(@@anonymous_module::AC1)
63
+ assert_equal Object, normalize_class(@@anonymous_module::AM1)
65
64
  end
66
65
 
67
66
  def test_related_classes
data/test/test_gettext.rb CHANGED
@@ -59,6 +59,29 @@ class TestGetText < Test::Unit::TestCase
59
59
  assert_equal("nomsgstr", _("nomsgstr"))
60
60
  end
61
61
 
62
+ def test_fallbacks
63
+ bindtextdomain("test1", "locale")
64
+ test = Simple.new
65
+
66
+ # Translation present in all candidates
67
+ GetText.set_current_locale("fr_BE_Foo")
68
+ assert_equal("french-Belgium-Foo", test.test)
69
+ GetText.set_current_locale("fr_BE")
70
+ assert_equal("french-Belgium", test.test)
71
+ GetText.set_current_locale("fr")
72
+ assert_equal("french", test.test)
73
+
74
+ # Translation Missing in fr_BE_Foo (fallback to fr_BE)
75
+ GetText.set_current_locale("fr_BE_Foo")
76
+ assert_equal("FRENCH-BELGIUM:ONE IS 1.", test.test_formatted_string)
77
+
78
+ # Translation Missing in fr_BE_Foo *and* fr_BE (both languages fallback to fr)
79
+ GetText.set_current_locale("fr_BE_Foo")
80
+ assert_equal("FRENCH:Il y a 5 pommes.", test.test_plural)
81
+ GetText.set_current_locale("fr_BE")
82
+ assert_equal("FRENCH:Il y a 5 pommes.", test.test_plural)
83
+ end
84
+
62
85
  def test_empty
63
86
  bindtextdomain("test1", "locale")
64
87
  assert_equal("japanese", gettext("language"))
@@ -235,7 +258,10 @@ DDD
235
258
  set_locale("fr")
236
259
  assert_equal("fr_first", n_("first", "second", 0))
237
260
  assert_equal("fr_first", n_("first", "second", 1))
238
- assert_equal("fr_first", n_("first", "second", 2))
261
+ assert_equal("fr_first", n_("first", "second", 2)) # no translation
262
+ assert_equal("fr_first_2", n_("first_2", "second_2", 0))
263
+ assert_equal("fr_first_2", n_("first_2", "second_2", 1))
264
+ assert_equal("", n_("first_2", "second_2", 2)) # empty translation
239
265
  set_locale("da") # Invalid Plural-Forms.
240
266
  assert_equal("da_first", n_("first", "second", 0))
241
267
  assert_equal("da_first", n_("first", "second", 1))
@@ -352,6 +378,9 @@ DDD
352
378
  end
353
379
 
354
380
  def test_safe_mode
381
+ if RUBY_VERSION >= "2.6.0"
382
+ omit("Per thread $SAFE is removed since Ruby 2.6.")
383
+ end
355
384
  Thread.start{
356
385
  $SAFE = 1
357
386
  GetText.bindtextdomain("test1", :path => "locale")
@@ -53,9 +53,11 @@ class TestLocalePath < Test::Unit::TestCase
53
53
  testdir = File.dirname(File.expand_path(__FILE__))
54
54
  path = GetText::LocalePath.new("test1", "#{testdir}/locale")
55
55
  assert_equal({
56
- "ja" => "#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
57
- "fr" => "#{testdir}/locale/fr/LC_MESSAGES/test1.mo",
58
- "zh_Hant" => "#{testdir}/locale/zh_Hant/LC_MESSAGES/test1.mo"
56
+ "ja" => "#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
57
+ "fr" => "#{testdir}/locale/fr/LC_MESSAGES/test1.mo",
58
+ "fr_BE" => "#{testdir}/locale/fr_BE/LC_MESSAGES/test1.mo",
59
+ "fr_BE_Foo" => "#{testdir}/locale/fr_BE_Foo/LC_MESSAGES/test1.mo",
60
+ "zh_Hant" => "#{testdir}/locale/zh_Hant/LC_MESSAGES/test1.mo"
59
61
  },
60
62
  path.locale_paths)
61
63
  assert_equal("#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
@@ -66,6 +68,12 @@ class TestLocalePath < Test::Unit::TestCase
66
68
  path.current_path(Locale::Tag.parse("ja_JP.UTF-8")))
67
69
  assert_equal(nil,
68
70
  path.current_path(Locale::Tag.parse("en")))
71
+ assert_equal("#{testdir}/locale/fr/LC_MESSAGES/test1.mo",
72
+ path.current_path(Locale::Tag.parse("fr")))
73
+ assert_equal("#{testdir}/locale/fr_BE/LC_MESSAGES/test1.mo",
74
+ path.current_path(Locale::Tag.parse("fr-BE")))
75
+ assert_equal("#{testdir}/locale/fr_BE_Foo/LC_MESSAGES/test1.mo",
76
+ path.current_path(Locale::Tag.parse("fr-BE-Foo")))
69
77
  assert_equal("#{testdir}/locale/zh_Hant/LC_MESSAGES/test1.mo",
70
78
  path.current_path(Locale::Tag.parse("zh-Hant")))
71
79
  end
@@ -73,7 +81,7 @@ class TestLocalePath < Test::Unit::TestCase
73
81
  def test_supported_locales
74
82
  testdir = File.dirname(File.expand_path(__FILE__))
75
83
  path = GetText::LocalePath.new("test1", "#{testdir}/locale")
76
- assert_equal ["fr", "ja", "zh_Hant"], path.supported_locales
84
+ assert_equal ["fr", "fr_BE", "fr_BE_Foo", "ja", "zh_Hant"], path.supported_locales
77
85
 
78
86
  path = GetText::LocalePath.new("plural", "#{testdir}/locale")
79
87
  assert_equal ["cr", "da", "fr", "ir", "ja", "la", "li", "po", "sl"], path.supported_locales