gettext 3.4.2 → 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -3
- data/doc/text/news.md +18 -0
- data/gettext.gemspec +2 -1
- data/lib/gettext/po_parser.rb +13 -13
- data/lib/gettext/tools/parser/erubi.rb +88 -0
- data/lib/gettext/tools/xgettext.rb +6 -0
- data/lib/gettext/version.rb +2 -2
- data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
- data/po/bg/gettext.edit.po +11 -10
- data/po/bg/gettext.po +3 -0
- data/po/bs/gettext.edit.po +11 -10
- data/po/bs/gettext.po +3 -0
- data/po/ca/gettext.edit.po +11 -10
- data/po/ca/gettext.po +3 -0
- data/po/cs/gettext.edit.po +11 -10
- data/po/cs/gettext.po +3 -0
- data/po/de/gettext.edit.po +11 -10
- data/po/de/gettext.po +3 -0
- data/po/el/gettext.edit.po +11 -10
- data/po/el/gettext.po +3 -0
- data/po/eo/gettext.edit.po +11 -10
- data/po/eo/gettext.po +3 -0
- data/po/es/gettext.edit.po +11 -10
- data/po/es/gettext.po +3 -0
- data/po/et/gettext.edit.po +11 -10
- data/po/et/gettext.po +3 -0
- data/po/fr/gettext.edit.po +11 -10
- data/po/fr/gettext.po +3 -0
- data/po/gettext.pot +14 -10
- data/po/hr/gettext.edit.po +11 -10
- data/po/hr/gettext.po +3 -0
- data/po/hu/gettext.edit.po +11 -10
- data/po/hu/gettext.po +3 -0
- data/po/it/gettext.edit.po +11 -10
- data/po/it/gettext.po +3 -0
- data/po/ja/gettext.edit.po +12 -11
- data/po/ja/gettext.po +4 -1
- data/po/ko/gettext.edit.po +11 -10
- data/po/ko/gettext.po +3 -0
- data/po/lv/gettext.edit.po +11 -10
- data/po/lv/gettext.po +3 -0
- data/po/nb/gettext.edit.po +11 -10
- data/po/nb/gettext.po +3 -0
- data/po/nl/gettext.edit.po +11 -10
- data/po/nl/gettext.po +3 -0
- data/po/pt_BR/gettext.edit.po +11 -10
- data/po/pt_BR/gettext.po +3 -0
- data/po/ru/gettext.edit.po +11 -10
- data/po/ru/gettext.po +3 -0
- data/po/sr/gettext.edit.po +11 -10
- data/po/sr/gettext.po +3 -0
- data/po/sv/gettext.edit.po +11 -7
- data/po/sv/gettext.po +3 -0
- data/po/uk/gettext.edit.po +11 -10
- data/po/uk/gettext.po +3 -0
- data/po/vi/gettext.edit.po +11 -10
- data/po/vi/gettext.po +3 -0
- data/po/zh/gettext.edit.po +11 -10
- data/po/zh/gettext.po +3 -0
- data/po/zh_TW/gettext.edit.po +11 -10
- data/po/zh_TW/gettext.po +3 -0
- data/samples/cgi/po/helloerb1.pot +3 -3
- data/samples/cgi/po/helloerb2.pot +3 -3
- data/samples/cgi/po/hellolib.pot +3 -3
- data/samples/cgi/po/main.pot +3 -3
- data/samples/po/bg/hello_gtk_builder.edit.po +15 -0
- data/samples/po/bg/hello_gtk_builder.po +12 -0
- data/samples/po/bs/hello_gtk_builder.edit.po +15 -0
- data/samples/po/bs/hello_gtk_builder.po +12 -0
- data/samples/po/ca/hello_gtk_builder.edit.po +15 -0
- data/samples/po/ca/hello_gtk_builder.po +12 -0
- data/samples/po/cs/hello_gtk_builder.edit.po +15 -0
- data/samples/po/cs/hello_gtk_builder.po +12 -0
- data/samples/po/de/hello_gtk_builder.edit.po +15 -0
- data/samples/po/de/hello_gtk_builder.po +12 -0
- data/samples/po/el/hello_gtk_builder.edit.po +15 -0
- data/samples/po/el/hello_gtk_builder.po +12 -0
- data/samples/po/eo/hello_gtk_builder.edit.po +15 -0
- data/samples/po/eo/hello_gtk_builder.po +12 -0
- data/samples/po/es/hello_gtk_builder.edit.po +15 -0
- data/samples/po/es/hello_gtk_builder.po +12 -0
- data/samples/po/fr/hello_gtk_builder.edit.po +15 -0
- data/samples/po/fr/hello_gtk_builder.po +12 -0
- data/samples/po/hello.pot +3 -3
- data/samples/po/hello2.pot +4 -4
- data/samples/po/hello_glade2.pot +8 -5
- data/samples/po/hello_gtk2.pot +4 -4
- data/samples/po/hello_gtk_builder.pot +18 -4
- data/samples/po/hello_noop.pot +4 -4
- data/samples/po/hello_plural.pot +4 -4
- data/samples/po/hello_tk.pot +4 -4
- data/samples/po/hr/hello_gtk_builder.edit.po +15 -0
- data/samples/po/hr/hello_gtk_builder.po +12 -0
- data/samples/po/hu/hello_gtk_builder.edit.po +15 -0
- data/samples/po/hu/hello_gtk_builder.po +12 -0
- data/samples/po/it/hello_gtk_builder.edit.po +15 -0
- data/samples/po/it/hello_gtk_builder.po +12 -0
- data/samples/po/ja/hello_gtk_builder.edit.po +15 -0
- data/samples/po/ja/hello_gtk_builder.po +12 -0
- data/samples/po/ko/hello_gtk_builder.edit.po +15 -0
- data/samples/po/ko/hello_gtk_builder.po +12 -0
- data/samples/po/lv/hello_gtk_builder.edit.po +15 -0
- data/samples/po/lv/hello_gtk_builder.po +12 -0
- data/samples/po/nb/hello_gtk_builder.edit.po +15 -0
- data/samples/po/nb/hello_gtk_builder.po +12 -0
- data/samples/po/nl/hello_gtk_builder.edit.po +15 -0
- data/samples/po/nl/hello_gtk_builder.po +12 -0
- data/samples/po/pt_BR/hello_gtk_builder.edit.po +15 -0
- data/samples/po/pt_BR/hello_gtk_builder.po +12 -0
- data/samples/po/ru/hello_gtk_builder.edit.po +15 -0
- data/samples/po/ru/hello_gtk_builder.po +12 -0
- data/samples/po/sr/hello_gtk_builder.edit.po +15 -0
- data/samples/po/sr/hello_gtk_builder.po +12 -0
- data/samples/po/sv/hello_gtk_builder.edit.po +15 -0
- data/samples/po/sv/hello_gtk_builder.po +12 -0
- data/samples/po/uk/hello_gtk_builder.edit.po +15 -0
- data/samples/po/uk/hello_gtk_builder.po +12 -0
- data/samples/po/vi/hello_gtk_builder.edit.po +15 -0
- data/samples/po/vi/hello_gtk_builder.po +12 -0
- data/samples/po/zh/hello_gtk_builder.edit.po +15 -0
- data/samples/po/zh/hello_gtk_builder.po +12 -0
- data/samples/po/zh_TW/hello_gtk_builder.edit.po +15 -0
- data/samples/po/zh_TW/hello_gtk_builder.po +12 -0
- data/test/fixtures/erb/case.rhtml +16 -0
- data/test/po/_.pot +3 -3
- data/test/po/backslash.pot +6 -4
- data/test/po/hello.pot +3 -3
- data/test/po/ja/_.po +15 -0
- data/test/po/ja/hello.edit.po +0 -1
- data/test/po/non_ascii.pot +4 -4
- data/test/po/np_.pot +3 -3
- data/test/po/ns_.pot +3 -3
- data/test/po/p_.pot +3 -3
- data/test/po/s_.pot +3 -3
- data/test/po/untranslated.pot +4 -4
- data/test/test_parser.rb +62 -0
- data/test/tools/test_msginit.rb +2 -2
- data/test/tools/test_xgettext.rb +85 -0
- metadata +30 -15
- data/test/fixtures/gtk_builder_ui_definitions.ui~ +0 -68
data/test/po/_.pot
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: _ 3.
|
9
|
+
"Project-Id-Version: _ 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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/backslash.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
|
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:
|
10
|
-
"
|
11
|
-
"
|
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"
|
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.
|
9
|
+
"Project-Id-Version: hello 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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/_.po
CHANGED
@@ -133,3 +133,18 @@ msgstr "ONE LINE"
|
|
133
133
|
msgid ""
|
134
134
|
"one new line\n"
|
135
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 ""
|
data/test/po/ja/hello.edit.po
CHANGED
data/test/po/non_ascii.pot
CHANGED
@@ -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
|
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:
|
9
|
+
"Project-Id-Version: non_ascii 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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
@@ -6,10 +6,10 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: np_ 3.
|
9
|
+
"Project-Id-Version: np_ 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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/ns_.pot
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: ns_ 3.
|
9
|
+
"Project-Id-Version: ns_ 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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/p_.pot
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: p_ 3.
|
9
|
+
"Project-Id-Version: p_ 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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
@@ -6,10 +6,10 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: s_ 3.
|
9
|
+
"Project-Id-Version: s_ 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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/untranslated.pot
CHANGED
@@ -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
|
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:
|
9
|
+
"Project-Id-Version: untranslated 3.4.4\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date:
|
12
|
-
"PO-Revision-Date:
|
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/test_parser.rb
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
require "tempfile"
|
25
25
|
require "gettext/tools/parser/ruby"
|
26
26
|
require "gettext/tools/parser/erb"
|
27
|
+
require "gettext/tools/parser/erubi"
|
27
28
|
|
28
29
|
require "gettext/tools/xgettext"
|
29
30
|
|
@@ -215,6 +216,67 @@ class TestGetTextParser < Test::Unit::TestCase
|
|
215
216
|
|
216
217
|
assert_target("Hello", ["#{path}:8"])
|
217
218
|
end
|
219
|
+
|
220
|
+
def test_case
|
221
|
+
path = fixture_path("erb", "case.rhtml")
|
222
|
+
@ary = GetText::ErbParser.parse(path)
|
223
|
+
|
224
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
|
225
|
+
assert_target("Hello", ["#{path}:11"])
|
226
|
+
assert_target("World", ["#{path}:14"])
|
227
|
+
else
|
228
|
+
assert_target("Hello", ["#{path}:11"])
|
229
|
+
assert_nil(@ary.detect {|elem| elem.msgid == 'World'}) # Not detected. see PR #91
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
class TestErubiParser < self
|
235
|
+
include Helper::Path
|
236
|
+
|
237
|
+
def test_detect_encoding
|
238
|
+
euc_file = Tempfile.new("euc-jp.rhtml")
|
239
|
+
euc_file.open
|
240
|
+
euc_file.puts("<%#-*- coding: euc-jp -*-%>")
|
241
|
+
euc_file.close
|
242
|
+
|
243
|
+
euc_file_content = File.read(euc_file.path)
|
244
|
+
encoding = GetText::ErubiParser.new(euc_file.path).detect_encoding(euc_file_content)
|
245
|
+
|
246
|
+
assert_equal("EUC-JP", encoding)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_ascii
|
250
|
+
path = fixture_path("erb", "ascii.rhtml")
|
251
|
+
@ary = GetText::ErubiParser.parse(path)
|
252
|
+
|
253
|
+
assert_target 'aaa', ["#{path}:8"]
|
254
|
+
assert_target "aaa\n", ["#{path}:11"]
|
255
|
+
assert_target 'bbb', ["#{path}:12"]
|
256
|
+
assert_plural_target "ccc1", "ccc2", ["#{path}:13"]
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_non_ascii
|
260
|
+
path = fixture_path("erb", "non_ascii.rhtml")
|
261
|
+
@ary = GetText::ErubiParser.parse(path)
|
262
|
+
|
263
|
+
assert_target('わたし', ["#{path}:12"])
|
264
|
+
end
|
265
|
+
|
266
|
+
def test_minus
|
267
|
+
path = fixture_path("erb", "minus.rhtml")
|
268
|
+
@ary = GetText::ErubiParser.parse(path)
|
269
|
+
|
270
|
+
assert_target("Hello", ["#{path}:8"])
|
271
|
+
end
|
272
|
+
|
273
|
+
def test_case
|
274
|
+
path = fixture_path("erb", "case.rhtml")
|
275
|
+
@ary = GetText::ErubiParser.parse(path)
|
276
|
+
|
277
|
+
assert_target("Hello", ["#{path}:11"])
|
278
|
+
assert_target("World", ["#{path}:14"]) # Detected with Erubi
|
279
|
+
end
|
218
280
|
end
|
219
281
|
|
220
282
|
def test_xgettext_parse
|
data/test/tools/test_msginit.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
2
|
-
# Copyright (C) 2012-
|
2
|
+
# Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
|
3
3
|
#
|
4
4
|
# License: Ruby's or LGPL
|
5
5
|
#
|
@@ -364,7 +364,7 @@ EOF
|
|
364
364
|
def test_ro
|
365
365
|
assert_equal("nplurals=3; " +
|
366
366
|
"plural=(n == 1) ? 0 : " +
|
367
|
-
"(n == 0) || ((n % 100) >=
|
367
|
+
"(n == 0) || (n != 1) && ((n % 100) >= 1 && (n % 100) <= 19) ? 1 : 2;",
|
368
368
|
@msginit.__send__(:plural_forms, "ro"))
|
369
369
|
end
|
370
370
|
|
data/test/tools/test_xgettext.rb
CHANGED
@@ -118,6 +118,91 @@ EOP
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
+
class TestParser < self
|
122
|
+
# Default ERB parser (don't find anything after "case")
|
123
|
+
def test_erb
|
124
|
+
rhtml = <<-EOR
|
125
|
+
<div>
|
126
|
+
<%= _('Hello') %>
|
127
|
+
<% case 1 %>
|
128
|
+
<% end %>
|
129
|
+
<%= _('World') %>
|
130
|
+
</div>
|
131
|
+
EOR
|
132
|
+
|
133
|
+
File.open(@rhtml_file_path, "w") do |rhtml_file|
|
134
|
+
rhtml_file.puts(rhtml)
|
135
|
+
end
|
136
|
+
|
137
|
+
@xgettext.run(
|
138
|
+
"--output", @pot_file_path,
|
139
|
+
@rhtml_file_path
|
140
|
+
)
|
141
|
+
|
142
|
+
pot_content = File.read(@pot_file_path)
|
143
|
+
|
144
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
|
145
|
+
expected_content = <<-EOP
|
146
|
+
#{header}
|
147
|
+
#: ../templates/xgettext.rhtml:2
|
148
|
+
msgid "Hello"
|
149
|
+
msgstr ""
|
150
|
+
|
151
|
+
#: ../templates/xgettext.rhtml:5
|
152
|
+
msgid "World"
|
153
|
+
msgstr ""
|
154
|
+
EOP
|
155
|
+
else
|
156
|
+
# "World" not detected. see PR #91
|
157
|
+
expected_content = <<-EOP
|
158
|
+
#{header}
|
159
|
+
#: ../templates/xgettext.rhtml:2
|
160
|
+
msgid "Hello"
|
161
|
+
msgstr ""
|
162
|
+
EOP
|
163
|
+
end
|
164
|
+
|
165
|
+
assert_equal(expected_content, pot_content)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Optional Erubi parser (find text after "case")
|
169
|
+
def test_erubi
|
170
|
+
rhtml = <<-EOR
|
171
|
+
<div>
|
172
|
+
<%= _('Hello') %>
|
173
|
+
<% case 1 %>
|
174
|
+
<% end %>
|
175
|
+
<%= _('World') %>
|
176
|
+
</div>
|
177
|
+
EOR
|
178
|
+
|
179
|
+
File.open(@rhtml_file_path, "w") do |rhtml_file|
|
180
|
+
rhtml_file.puts(rhtml)
|
181
|
+
end
|
182
|
+
|
183
|
+
@xgettext.run(
|
184
|
+
"--output", @pot_file_path,
|
185
|
+
'--require', 'gettext/tools/parser/erubi',
|
186
|
+
'--parser', 'GetText::ErubiParser',
|
187
|
+
@rhtml_file_path
|
188
|
+
)
|
189
|
+
|
190
|
+
pot_content = File.read(@pot_file_path)
|
191
|
+
expected_content = <<-EOP
|
192
|
+
#{header}
|
193
|
+
#: ../templates/xgettext.rhtml:2
|
194
|
+
msgid "Hello"
|
195
|
+
msgstr ""
|
196
|
+
|
197
|
+
#: ../templates/xgettext.rhtml:5
|
198
|
+
msgid "World"
|
199
|
+
msgstr ""
|
200
|
+
EOP
|
201
|
+
|
202
|
+
assert_equal(expected_content, pot_content)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
121
206
|
class TestEncoding < self
|
122
207
|
def test_different_encoding_from_current_locale
|
123
208
|
rhtml = <<-EOR
|
metadata
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
- Masao Mutoh
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: erubi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: locale
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,35 +54,35 @@ dependencies:
|
|
40
54
|
- !ruby/object:Gem::Version
|
41
55
|
version: '0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
57
|
+
name: racc
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - ">="
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
62
|
+
version: '0'
|
49
63
|
type: :runtime
|
50
64
|
prerelease: false
|
51
65
|
version_requirements: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
67
|
- - ">="
|
54
68
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
69
|
+
version: '0'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
71
|
+
name: text
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
74
|
- - ">="
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
63
|
-
type: :
|
76
|
+
version: 1.3.0
|
77
|
+
type: :runtime
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - ">="
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
83
|
+
version: 1.3.0
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
85
|
+
name: kramdown
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
88
|
- - ">="
|
@@ -198,6 +212,7 @@ files:
|
|
198
212
|
- lib/gettext/tools/msginit.rb
|
199
213
|
- lib/gettext/tools/msgmerge.rb
|
200
214
|
- lib/gettext/tools/parser/erb.rb
|
215
|
+
- lib/gettext/tools/parser/erubi.rb
|
201
216
|
- lib/gettext/tools/parser/glade.rb
|
202
217
|
- lib/gettext/tools/parser/gtk_builder_ui_definitions.rb
|
203
218
|
- lib/gettext/tools/parser/ruby.rb
|
@@ -1545,12 +1560,12 @@ files:
|
|
1545
1560
|
- test/fixtures/backslash.rb
|
1546
1561
|
- test/fixtures/erb/ascii.rhtml
|
1547
1562
|
- test/fixtures/erb/ascii.rxml
|
1563
|
+
- test/fixtures/erb/case.rhtml
|
1548
1564
|
- test/fixtures/erb/minus.rhtml
|
1549
1565
|
- test/fixtures/erb/non_ascii.rhtml
|
1550
1566
|
- test/fixtures/glade/2.glade
|
1551
1567
|
- test/fixtures/glade/3.glade
|
1552
1568
|
- test/fixtures/gtk_builder_ui_definitions.ui
|
1553
|
-
- test/fixtures/gtk_builder_ui_definitions.ui~
|
1554
1569
|
- test/fixtures/hello.rb
|
1555
1570
|
- test/fixtures/lower_n_.rb
|
1556
1571
|
- test/fixtures/multi_text_domain.rb
|
@@ -1698,7 +1713,7 @@ licenses:
|
|
1698
1713
|
- Ruby
|
1699
1714
|
- LGPL-3.0+
|
1700
1715
|
metadata: {}
|
1701
|
-
post_install_message:
|
1716
|
+
post_install_message:
|
1702
1717
|
rdoc_options: []
|
1703
1718
|
require_paths:
|
1704
1719
|
- lib
|
@@ -1713,8 +1728,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1713
1728
|
- !ruby/object:Gem::Version
|
1714
1729
|
version: '0'
|
1715
1730
|
requirements: []
|
1716
|
-
rubygems_version: 3.
|
1717
|
-
signing_key:
|
1731
|
+
rubygems_version: 3.5.0.dev
|
1732
|
+
signing_key:
|
1718
1733
|
specification_version: 4
|
1719
1734
|
summary: Gettext is a pure Ruby libary and tools to localize messages.
|
1720
1735
|
test_files:
|
@@ -1,68 +0,0 @@
|
|
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>
|