gettext 3.3.6 → 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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/Rakefile +5 -3
- data/doc/text/news.md +168 -0
- data/gettext.gemspec +7 -4
- data/lib/gettext/mo.rb +12 -19
- data/lib/gettext/po_entry.rb +31 -21
- data/lib/gettext/po_parser.rb +65 -59
- data/lib/gettext/text_domain_manager.rb +6 -5
- data/lib/gettext/tools/msgcat.rb +9 -2
- data/lib/gettext/tools/msginit.rb +221 -50
- data/lib/gettext/tools/msgmerge.rb +24 -6
- data/lib/gettext/tools/parser/erubi.rb +88 -0
- data/lib/gettext/tools/parser/glade.rb +38 -40
- data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +6 -3
- data/lib/gettext/tools/parser/ruby.rb +2 -2
- data/lib/gettext/tools/task.rb +3 -5
- data/lib/gettext/tools/xgettext.rb +15 -4
- data/lib/gettext/version.rb +3 -3
- data/locale/bg/LC_MESSAGES/gettext.mo +0 -0
- data/locale/bs/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ca/LC_MESSAGES/gettext.mo +0 -0
- data/locale/cs/LC_MESSAGES/gettext.mo +0 -0
- data/locale/de/LC_MESSAGES/gettext.mo +0 -0
- data/locale/el/LC_MESSAGES/gettext.mo +0 -0
- data/locale/eo/LC_MESSAGES/gettext.mo +0 -0
- data/locale/es/LC_MESSAGES/gettext.mo +0 -0
- data/locale/et/LC_MESSAGES/gettext.mo +0 -0
- data/locale/fr/LC_MESSAGES/gettext.mo +0 -0
- data/locale/hr/LC_MESSAGES/gettext.mo +0 -0
- data/locale/hu/LC_MESSAGES/gettext.mo +0 -0
- data/locale/it/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ja/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ko/LC_MESSAGES/gettext.mo +0 -0
- data/locale/lv/LC_MESSAGES/gettext.mo +0 -0
- data/locale/nb/LC_MESSAGES/gettext.mo +0 -0
- data/locale/nl/LC_MESSAGES/gettext.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/gettext.mo +0 -0
- data/locale/ru/LC_MESSAGES/gettext.mo +0 -0
- data/locale/sr/LC_MESSAGES/gettext.mo +0 -0
- data/locale/uk/LC_MESSAGES/gettext.mo +0 -0
- data/locale/vi/LC_MESSAGES/gettext.mo +0 -0
- data/locale/zh/LC_MESSAGES/gettext.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/gettext.mo +0 -0
- data/po/bg/gettext.edit.po +80 -593
- data/po/bg/gettext.po +6 -423
- data/po/bs/gettext.edit.po +80 -593
- data/po/bs/gettext.po +6 -423
- data/po/ca/gettext.edit.po +80 -593
- data/po/ca/gettext.po +6 -423
- data/po/cs/gettext.edit.po +80 -593
- data/po/cs/gettext.po +6 -423
- data/po/de/gettext.edit.po +80 -593
- data/po/de/gettext.po +6 -423
- data/po/el/gettext.edit.po +80 -593
- data/po/el/gettext.po +6 -423
- data/po/eo/gettext.edit.po +80 -593
- data/po/eo/gettext.po +6 -423
- data/po/es/gettext.edit.po +80 -593
- data/po/es/gettext.po +6 -423
- data/po/et/gettext.edit.po +80 -593
- data/po/et/gettext.po +6 -423
- data/po/fr/gettext.edit.po +80 -593
- data/po/fr/gettext.po +6 -423
- data/po/gettext.pot +92 -665
- data/po/hr/gettext.edit.po +80 -593
- data/po/hr/gettext.po +6 -423
- data/po/hu/gettext.edit.po +80 -593
- data/po/hu/gettext.po +6 -423
- data/po/it/gettext.edit.po +80 -593
- data/po/it/gettext.po +6 -423
- data/po/ja/gettext.edit.po +81 -594
- data/po/ja/gettext.po +7 -424
- data/po/ko/gettext.edit.po +80 -593
- data/po/ko/gettext.po +6 -423
- data/po/lv/gettext.edit.po +80 -593
- data/po/lv/gettext.po +6 -423
- data/po/nb/gettext.edit.po +80 -593
- data/po/nb/gettext.po +6 -423
- data/po/nl/gettext.edit.po +80 -593
- data/po/nl/gettext.po +6 -423
- data/po/pt_BR/gettext.edit.po +80 -593
- data/po/pt_BR/gettext.po +6 -423
- data/po/ru/gettext.edit.po +80 -593
- data/po/ru/gettext.po +6 -423
- data/po/sr/gettext.edit.po +80 -593
- data/po/sr/gettext.po +6 -423
- data/po/sv/gettext.edit.po +80 -593
- data/po/sv/gettext.po +6 -423
- data/po/uk/gettext.edit.po +80 -593
- data/po/uk/gettext.po +6 -423
- data/po/vi/gettext.edit.po +80 -593
- data/po/vi/gettext.po +6 -423
- data/po/zh/gettext.edit.po +80 -593
- data/po/zh/gettext.po +6 -423
- data/po/zh_TW/gettext.edit.po +80 -593
- data/po/zh_TW/gettext.po +6 -423
- 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/src/po_parser.ry +48 -42
- data/test/fixtures/_.rb +1 -1
- data/test/fixtures/erb/case.rhtml +16 -0
- data/test/fixtures/{gtk_builder_ui_definitions.ui~ → glade/3.glade} +12 -17
- data/test/fixtures/multi_text_domain.rb +12 -12
- data/test/fixtures/np_.rb +1 -1
- data/test/fixtures/ns_.rb +1 -1
- data/test/fixtures/p_.rb +1 -1
- data/test/fixtures/s_.rb +1 -1
- data/test/fixtures/simple.rb +5 -1
- data/test/fixtures/upper_nn_.rb +77 -0
- data/test/locale/fr/LC_MESSAGES/test1.mo +0 -0
- data/test/locale/fr_BE/LC_MESSAGES/test1.mo +0 -0
- data/test/locale/fr_BE_Foo/LC_MESSAGES/test1.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/_.mo +0 -0
- data/test/po/_.pot +20 -4
- data/test/po/backslash.pot +6 -4
- data/test/po/fr/test1.po +7 -0
- data/test/po/fr_BE/test1.po +24 -0
- data/test/po/fr_BE_Foo/test1.po +20 -0
- data/test/po/hello.pot +3 -3
- data/test/po/ja/_.edit.po +27 -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 +8 -5
- data/test/po/ns_.pot +6 -4
- data/test/po/p_.pot +3 -3
- data/test/po/s_.pot +6 -4
- data/test/po/untranslated.pot +4 -4
- data/test/test_gettext.rb +23 -0
- data/test/test_locale_path.rb +12 -4
- data/test/test_parser.rb +97 -17
- data/test/test_po_entry.rb +20 -4
- data/test/test_po_parser.rb +44 -1
- data/test/tools/parser/test_glade.rb +91 -0
- data/test/tools/parser/test_gtk_builder_ui_definitions.rb +19 -1
- data/test/tools/parser/test_ruby.rb +4 -4
- data/test/tools/test_msgcat.rb +21 -1
- data/test/tools/test_msginit.rb +82 -3
- data/test/tools/test_msgmerge.rb +75 -3
- data/test/tools/test_xgettext.rb +100 -3
- metadata +70 -19
- /data/test/fixtures/{gladeparser.glade → glade/2.glade} +0 -0
- /data/test/fixtures/ruby/{percent_i.rb → percent_lower_i.rb} +0 -0
- /data/test/fixtures/ruby/{percent_w.rb → percent_lower_w.rb} +0 -0
- /data/test/fixtures/ruby/{percent_I.rb → percent_upper_i.rb} +0 -0
- /data/test/fixtures/ruby/{percent_W.rb → percent_upper_w.rb} +0 -0
|
@@ -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
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
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"
|
|
@@ -165,6 +165,22 @@ msgid ""
|
|
|
165
165
|
"one new line\n"
|
|
166
166
|
msgstr ""
|
|
167
167
|
|
|
168
|
-
#: ../fixtures/_/percent_strings.rb:
|
|
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/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/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.
|
|
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/_.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:
|
|
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 "
|
|
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
|
@@ -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
|
@@ -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
|
|
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:
|
|
10
|
-
"
|
|
11
|
-
"
|
|
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
|
|
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
|
|
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:
|
|
10
|
-
"
|
|
11
|
-
"
|
|
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.
|
|
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
|
@@ -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 s_ 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: 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"
|
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_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"))
|
data/test/test_locale_path.rb
CHANGED
|
@@ -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"
|
|
57
|
-
"fr"
|
|
58
|
-
"
|
|
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
|
data/test/test_parser.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
3
|
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
|
4
|
-
# Copyright (C) 2012-
|
|
4
|
+
# Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
|
|
5
5
|
# Copyright (C) 2010 masone (Christian Felder) <ema@rh-productions.ch>
|
|
6
6
|
# Copyright (C) 2009 Vladimir Dobriakov <vladimir@geekq.net>
|
|
7
7
|
# Copyright (C) 2009-2010 Masao Mutoh
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
require "tempfile"
|
|
25
25
|
require "gettext/tools/parser/ruby"
|
|
26
|
-
require "gettext/tools/parser/glade"
|
|
27
26
|
require "gettext/tools/parser/erb"
|
|
27
|
+
require "gettext/tools/parser/erubi"
|
|
28
28
|
|
|
29
29
|
require "gettext/tools/xgettext"
|
|
30
30
|
|
|
@@ -97,6 +97,40 @@ class TestGetTextParser < Test::Unit::TestCase
|
|
|
97
97
|
['fixtures/upper_n_.rb:64'])
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
+
def test_Nn_
|
|
101
|
+
@ary = @xgettext.parse(['fixtures/upper_nn_.rb'])
|
|
102
|
+
|
|
103
|
+
assert_plural_target('aaa', 'aaas',
|
|
104
|
+
['fixtures/upper_nn_.rb:10'])
|
|
105
|
+
assert_plural_target("aaa\n", "aaas\n",
|
|
106
|
+
['fixtures/upper_nn_.rb:14'])
|
|
107
|
+
assert_plural_target("bbb\nccc", "bbbs\ncccs",
|
|
108
|
+
['fixtures/upper_nn_.rb:18'])
|
|
109
|
+
assert_plural_target("bbb\nccc\nddd\n", "bbbs\ncccs\nddds\n",
|
|
110
|
+
['fixtures/upper_nn_.rb:22'])
|
|
111
|
+
assert_plural_target('eee', 'eees',
|
|
112
|
+
[
|
|
113
|
+
'fixtures/upper_nn_.rb:33',
|
|
114
|
+
'fixtures/upper_nn_.rb:37',
|
|
115
|
+
])
|
|
116
|
+
assert_plural_target('fff', 'fffs',
|
|
117
|
+
['fixtures/upper_nn_.rb:37'])
|
|
118
|
+
assert_plural_target('ggghhhiii', 'gggshhhsiiis',
|
|
119
|
+
['fixtures/upper_nn_.rb:41'])
|
|
120
|
+
assert_plural_target('a"b"c"', 'as"bs"cs"',
|
|
121
|
+
['fixtures/upper_nn_.rb:50'])
|
|
122
|
+
assert_plural_target('d"e"f"', 'ds"es"fs"',
|
|
123
|
+
['fixtures/upper_nn_.rb:54'])
|
|
124
|
+
assert_plural_target('jjj', 'jjjs',
|
|
125
|
+
['fixtures/upper_nn_.rb:58'])
|
|
126
|
+
assert_plural_target('kkk', 'kkks',
|
|
127
|
+
['fixtures/upper_nn_.rb:59'])
|
|
128
|
+
assert_plural_target('lllmmm', 'lllsmmms',
|
|
129
|
+
['fixtures/upper_nn_.rb:63'])
|
|
130
|
+
assert_plural_target("nnn\nooo", "nnns\nooos",
|
|
131
|
+
['fixtures/upper_nn_.rb:71'])
|
|
132
|
+
end
|
|
133
|
+
|
|
100
134
|
def test_n_
|
|
101
135
|
@xgettext.parse_options[:comment_tag] = "TRANSLATORS:"
|
|
102
136
|
@ary = @xgettext.parse(['fixtures/lower_n_.rb'])
|
|
@@ -144,21 +178,6 @@ class TestGetTextParser < Test::Unit::TestCase
|
|
|
144
178
|
end
|
|
145
179
|
end
|
|
146
180
|
|
|
147
|
-
class TestGlade < self
|
|
148
|
-
def test_old_style
|
|
149
|
-
# Old style (~2.0.4)
|
|
150
|
-
ary = GetText::GladeParser.parse('fixtures/gladeparser.glade')
|
|
151
|
-
|
|
152
|
-
assert_equal(['window1', 'fixtures/gladeparser.glade:8'], ary[0])
|
|
153
|
-
assert_equal(['normal text', 'fixtures/gladeparser.glade:29'], ary[1])
|
|
154
|
-
assert_equal(['1st line\n2nd line\n3rd line', 'fixtures/gladeparser.glade:50'], ary[2])
|
|
155
|
-
assert_equal(['<span color="red" weight="bold" size="large">markup </span>', 'fixtures/gladeparser.glade:73'], ary[3])
|
|
156
|
-
assert_equal(['<span color="red">1st line markup </span>\n<span color="blue">2nd line markup</span>', 'fixtures/gladeparser.glade:94'], ary[4])
|
|
157
|
-
assert_equal(['<span>"markup" with <escaped strings></span>', 'fixtures/gladeparser.glade:116'], ary[5])
|
|
158
|
-
assert_equal(['duplicated', 'fixtures/gladeparser.glade:137', 'fixtures/gladeparser.glade:158'], ary[6])
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
|
|
162
181
|
class TestErbParser < self
|
|
163
182
|
include Helper::Path
|
|
164
183
|
|
|
@@ -197,6 +216,67 @@ class TestGetTextParser < Test::Unit::TestCase
|
|
|
197
216
|
|
|
198
217
|
assert_target("Hello", ["#{path}:8"])
|
|
199
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
|
|
200
280
|
end
|
|
201
281
|
|
|
202
282
|
def test_xgettext_parse
|