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.
- checksums.yaml +4 -4
- data/README.md +276 -198
- data/Rakefile +7 -4
- data/doc/text/news.md +451 -0
- data/gettext.gemspec +10 -7
- data/lib/gettext/locale_path.rb +17 -9
- data/lib/gettext/mo.rb +12 -19
- data/lib/gettext/po.rb +4 -4
- data/lib/gettext/po_entry.rb +47 -27
- data/lib/gettext/po_parser.rb +65 -59
- data/lib/gettext/text_domain.rb +1 -1
- data/lib/gettext/text_domain_manager.rb +6 -5
- data/lib/gettext/tools/msgcat.rb +9 -2
- data/lib/gettext/tools/msginit.rb +226 -54
- data/lib/gettext/tools/msgmerge.rb +24 -6
- data/lib/gettext/tools/parser/erb.rb +9 -1
- 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 +129 -0
- data/lib/gettext/tools/parser/ruby.rb +288 -221
- data/lib/gettext/tools/task.rb +4 -5
- data/lib/gettext/tools/xgettext.rb +21 -10
- 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 +81 -572
- data/po/bg/gettext.po +7 -409
- data/po/bs/gettext.edit.po +81 -572
- data/po/bs/gettext.po +7 -409
- data/po/ca/gettext.edit.po +81 -572
- data/po/ca/gettext.po +7 -409
- data/po/cs/gettext.edit.po +81 -572
- data/po/cs/gettext.po +7 -409
- data/po/de/gettext.edit.po +81 -572
- data/po/de/gettext.po +7 -409
- data/po/el/gettext.edit.po +81 -572
- data/po/el/gettext.po +7 -409
- data/po/eo/gettext.edit.po +81 -572
- data/po/eo/gettext.po +7 -409
- data/po/es/gettext.edit.po +81 -572
- data/po/es/gettext.po +7 -409
- data/po/et/gettext.edit.po +81 -572
- data/po/et/gettext.po +7 -409
- data/po/fr/gettext.edit.po +81 -572
- data/po/fr/gettext.po +7 -409
- data/po/gettext.pot +93 -645
- data/po/hr/gettext.edit.po +81 -572
- data/po/hr/gettext.po +7 -409
- data/po/hu/gettext.edit.po +81 -572
- data/po/hu/gettext.po +7 -409
- data/po/it/gettext.edit.po +81 -572
- data/po/it/gettext.po +7 -409
- data/po/ja/gettext.edit.po +83 -574
- data/po/ja/gettext.po +9 -411
- data/po/ko/gettext.edit.po +81 -572
- data/po/ko/gettext.po +7 -409
- data/po/lv/gettext.edit.po +81 -572
- data/po/lv/gettext.po +7 -409
- data/po/nb/gettext.edit.po +81 -572
- data/po/nb/gettext.po +7 -409
- data/po/nl/gettext.edit.po +81 -572
- data/po/nl/gettext.po +7 -409
- data/po/pt_BR/gettext.edit.po +81 -572
- data/po/pt_BR/gettext.po +7 -409
- data/po/ru/gettext.edit.po +81 -572
- data/po/ru/gettext.po +7 -409
- data/po/sr/gettext.edit.po +81 -572
- data/po/sr/gettext.po +7 -409
- data/po/sv/gettext.edit.po +81 -572
- data/po/sv/gettext.po +7 -409
- data/po/uk/gettext.edit.po +81 -572
- data/po/uk/gettext.po +7 -409
- data/po/vi/gettext.edit.po +81 -572
- data/po/vi/gettext.po +7 -409
- data/po/zh/gettext.edit.po +81 -572
- data/po/zh/gettext.po +7 -409
- data/po/zh_TW/gettext.edit.po +81 -572
- data/po/zh_TW/gettext.po +7 -409
- 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/_/backtick.rb +30 -0
- data/test/fixtures/_/block_parameter.rb +2 -2
- data/test/fixtures/_/double_quote_in_double_quote.rb +2 -2
- data/test/fixtures/_/double_quote_in_single_quote.rb +2 -2
- data/test/fixtures/_/literal_concatenation_with_continuation_line.rb +2 -2
- data/test/fixtures/_/middle_new_line.rb +2 -2
- data/test/fixtures/_/multiple_lines_literal.rb +2 -2
- data/test/fixtures/_/multiple_messages_in_same_line.rb +2 -2
- data/test/fixtures/_/multiple_same_messages.rb +2 -2
- data/test/fixtures/_/one_line.rb +2 -2
- data/test/fixtures/_/one_new_line.rb +2 -2
- data/test/fixtures/_/percent_strings.rb +55 -0
- data/test/fixtures/_/pipe.rb +32 -0
- data/test/{gettext-test-utils.rb → fixtures/_/quoted_symbol.rb} +13 -23
- data/test/fixtures/_.rb +10 -1
- data/test/fixtures/erb/case.rhtml +16 -0
- data/test/fixtures/erb/minus.rhtml +12 -0
- data/test/fixtures/erb/non_ascii.rhtml +1 -0
- data/test/fixtures/glade/3.glade +63 -0
- data/test/fixtures/gtk_builder_ui_definitions.ui +68 -0
- data/test/fixtures/multi_text_domain.rb +12 -12
- data/test/fixtures/np_.rb +1 -1
- data/test/fixtures/ns_/custom.rb +2 -2
- data/test/fixtures/ns_.rb +1 -1
- data/test/fixtures/p_.rb +1 -1
- data/test/fixtures/ruby/percent_lower_i.rb +1 -0
- data/test/fixtures/ruby/percent_lower_w.rb +1 -0
- data/test/fixtures/ruby/percent_upper_i.rb +1 -0
- data/test/fixtures/ruby/percent_upper_w.rb +1 -0
- data/test/fixtures/s_/custom.rb +2 -2
- data/test/fixtures/s_.rb +1 -1
- data/test/fixtures/simple.rb +5 -1
- data/test/fixtures/upper_nn_.rb +77 -0
- data/test/helper.rb +99 -0
- data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -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 +28 -4
- data/test/po/backslash.pot +6 -4
- data/test/po/fr/plural_error.po +7 -0
- 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 +20 -2
- 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/run-test.rb +2 -3
- data/test/test_class_info.rb +8 -9
- data/test/test_gettext.rb +30 -1
- data/test/test_locale_path.rb +12 -4
- data/test/test_parser.rb +113 -25
- data/test/test_po_entry.rb +21 -17
- data/test/test_po_parser.rb +49 -4
- data/test/test_string.rb +9 -5
- data/test/tools/parser/test_glade.rb +91 -0
- data/test/tools/parser/test_gtk_builder_ui_definitions.rb +63 -0
- data/test/tools/parser/test_ruby.rb +76 -39
- data/test/tools/test_msgcat.rb +21 -1
- data/test/tools/test_msginit.rb +82 -3
- data/test/tools/test_msgmerge.rb +81 -6
- data/test/tools/test_xgettext.rb +106 -5
- metadata +82 -34
- data/lib/gettext/tools/parser/haml.rb +0 -61
- /data/test/fixtures/{gladeparser.glade → glade/2.glade} +0 -0
|
@@ -17,3 +17,15 @@ msgstr ""
|
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4"
|
|
18
18
|
" && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
19
19
|
"\n"
|
|
20
|
+
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
msgid ""
|
|
25
|
+
"first line\n"
|
|
26
|
+
"second line\n"
|
|
27
|
+
"third line"
|
|
28
|
+
msgstr ""
|
|
29
|
+
|
|
30
|
+
msgid "<Hello world>"
|
|
31
|
+
msgstr ""
|
|
@@ -17,3 +17,18 @@ msgstr ""
|
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4"
|
|
18
18
|
" && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
19
19
|
"\n"
|
|
20
|
+
|
|
21
|
+
#: ../hello_gtk_builder.ui:7
|
|
22
|
+
msgid "window1"
|
|
23
|
+
msgstr ""
|
|
24
|
+
|
|
25
|
+
#: ../hello_gtk_builder.ui:16
|
|
26
|
+
msgid ""
|
|
27
|
+
"first line\n"
|
|
28
|
+
"second line\n"
|
|
29
|
+
"third line"
|
|
30
|
+
msgstr ""
|
|
31
|
+
|
|
32
|
+
#: ../hello_gtk_builder.ui:28
|
|
33
|
+
msgid "<Hello world>"
|
|
34
|
+
msgstr ""
|
|
@@ -17,3 +17,15 @@ msgstr ""
|
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4"
|
|
18
18
|
" && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
19
19
|
"\n"
|
|
20
|
+
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
msgid ""
|
|
25
|
+
"first line\n"
|
|
26
|
+
"second line\n"
|
|
27
|
+
"third line"
|
|
28
|
+
msgstr ""
|
|
29
|
+
|
|
30
|
+
msgid "<Hello world>"
|
|
31
|
+
msgstr ""
|
|
@@ -16,3 +16,18 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
#: ../hello_gtk_builder.ui:7
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: ../hello_gtk_builder.ui:16
|
|
25
|
+
msgid ""
|
|
26
|
+
"first line\n"
|
|
27
|
+
"second line\n"
|
|
28
|
+
"third line"
|
|
29
|
+
msgstr ""
|
|
30
|
+
|
|
31
|
+
#: ../hello_gtk_builder.ui:28
|
|
32
|
+
msgid "<Hello world>"
|
|
33
|
+
msgstr ""
|
|
@@ -16,3 +16,15 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
msgid "window1"
|
|
21
|
+
msgstr ""
|
|
22
|
+
|
|
23
|
+
msgid ""
|
|
24
|
+
"first line\n"
|
|
25
|
+
"second line\n"
|
|
26
|
+
"third line"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
msgid "<Hello world>"
|
|
30
|
+
msgstr ""
|
|
@@ -17,3 +17,18 @@ msgstr ""
|
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4"
|
|
18
18
|
" && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
19
19
|
"\n"
|
|
20
|
+
|
|
21
|
+
#: ../hello_gtk_builder.ui:7
|
|
22
|
+
msgid "window1"
|
|
23
|
+
msgstr ""
|
|
24
|
+
|
|
25
|
+
#: ../hello_gtk_builder.ui:16
|
|
26
|
+
msgid ""
|
|
27
|
+
"first line\n"
|
|
28
|
+
"second line\n"
|
|
29
|
+
"third line"
|
|
30
|
+
msgstr ""
|
|
31
|
+
|
|
32
|
+
#: ../hello_gtk_builder.ui:28
|
|
33
|
+
msgid "<Hello world>"
|
|
34
|
+
msgstr ""
|
|
@@ -17,3 +17,15 @@ msgstr ""
|
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4"
|
|
18
18
|
" && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
19
19
|
"\n"
|
|
20
|
+
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
msgid ""
|
|
25
|
+
"first line\n"
|
|
26
|
+
"second line\n"
|
|
27
|
+
"third line"
|
|
28
|
+
msgstr ""
|
|
29
|
+
|
|
30
|
+
msgid "<Hello world>"
|
|
31
|
+
msgstr ""
|
|
@@ -16,3 +16,18 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
#: ../hello_gtk_builder.ui:7
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: ../hello_gtk_builder.ui:16
|
|
25
|
+
msgid ""
|
|
26
|
+
"first line\n"
|
|
27
|
+
"second line\n"
|
|
28
|
+
"third line"
|
|
29
|
+
msgstr ""
|
|
30
|
+
|
|
31
|
+
#: ../hello_gtk_builder.ui:28
|
|
32
|
+
msgid "<Hello world>"
|
|
33
|
+
msgstr ""
|
|
@@ -16,3 +16,15 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
msgid "window1"
|
|
21
|
+
msgstr ""
|
|
22
|
+
|
|
23
|
+
msgid ""
|
|
24
|
+
"first line\n"
|
|
25
|
+
"second line\n"
|
|
26
|
+
"third line"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
msgid "<Hello world>"
|
|
30
|
+
msgstr ""
|
|
@@ -16,3 +16,18 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
#: ../hello_gtk_builder.ui:7
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: ../hello_gtk_builder.ui:16
|
|
25
|
+
msgid ""
|
|
26
|
+
"first line\n"
|
|
27
|
+
"second line\n"
|
|
28
|
+
"third line"
|
|
29
|
+
msgstr ""
|
|
30
|
+
|
|
31
|
+
#: ../hello_gtk_builder.ui:28
|
|
32
|
+
msgid "<Hello world>"
|
|
33
|
+
msgstr ""
|
|
@@ -16,3 +16,15 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
msgid "window1"
|
|
21
|
+
msgstr ""
|
|
22
|
+
|
|
23
|
+
msgid ""
|
|
24
|
+
"first line\n"
|
|
25
|
+
"second line\n"
|
|
26
|
+
"third line"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
msgid "<Hello world>"
|
|
30
|
+
msgstr ""
|
|
@@ -16,3 +16,18 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
#: ../hello_gtk_builder.ui:7
|
|
21
|
+
msgid "window1"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: ../hello_gtk_builder.ui:16
|
|
25
|
+
msgid ""
|
|
26
|
+
"first line\n"
|
|
27
|
+
"second line\n"
|
|
28
|
+
"third line"
|
|
29
|
+
msgstr ""
|
|
30
|
+
|
|
31
|
+
#: ../hello_gtk_builder.ui:28
|
|
32
|
+
msgid "<Hello world>"
|
|
33
|
+
msgstr ""
|
|
@@ -16,3 +16,15 @@ msgstr ""
|
|
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
"\n"
|
|
19
|
+
|
|
20
|
+
msgid "window1"
|
|
21
|
+
msgstr ""
|
|
22
|
+
|
|
23
|
+
msgid ""
|
|
24
|
+
"first line\n"
|
|
25
|
+
"second line\n"
|
|
26
|
+
"third line"
|
|
27
|
+
msgstr ""
|
|
28
|
+
|
|
29
|
+
msgid "<Hello world>"
|
|
30
|
+
msgstr ""
|
data/src/po_parser.ry
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
#
|
|
3
3
|
# po_parser.ry - ruby version of msgfmt
|
|
4
4
|
#
|
|
5
|
-
# Copyright (C) 2002-2008
|
|
6
|
-
# Copyright (C) 2012-
|
|
7
|
-
# Copyright (C) 2012-2013
|
|
5
|
+
# Copyright (C) 2002-2008 Masao Mutoh <mutomasa at gmail.com>
|
|
6
|
+
# Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
|
|
7
|
+
# Copyright (C) 2012-2013 Haruka Yoshihara <yoshihara@clear-code.com>
|
|
8
8
|
#
|
|
9
9
|
# You may redistribute it and/or modify it under the same
|
|
10
10
|
# license terms as Ruby or LGPL.
|
|
@@ -24,7 +24,7 @@ class GetText::POParser
|
|
|
24
24
|
msgctxt
|
|
25
25
|
: MSGCTXT string_list
|
|
26
26
|
{
|
|
27
|
-
@msgctxt =
|
|
27
|
+
@msgctxt = val[1]
|
|
28
28
|
}
|
|
29
29
|
;
|
|
30
30
|
|
|
@@ -36,9 +36,8 @@ class GetText::POParser
|
|
|
36
36
|
single_message
|
|
37
37
|
: MSGID string_list MSGSTR string_list
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
msgstr = unescape(val[3])
|
|
39
|
+
msgid = val[1]
|
|
40
|
+
msgstr = val[3]
|
|
42
41
|
use_message_p = true
|
|
43
42
|
if @fuzzy and not msgid.empty?
|
|
44
43
|
use_message_p = (not ignore_fuzzy?)
|
|
@@ -48,11 +47,15 @@ class GetText::POParser
|
|
|
48
47
|
else
|
|
49
48
|
$stderr.print _("Warning: fuzzy message was used.\n")
|
|
50
49
|
end
|
|
51
|
-
$stderr.print " #{@po_file}: msgid '#{
|
|
50
|
+
$stderr.print " #{@po_file}: msgid '#{msgid}'\n"
|
|
52
51
|
end
|
|
53
52
|
end
|
|
54
53
|
@fuzzy = false
|
|
55
|
-
|
|
54
|
+
if use_message_p
|
|
55
|
+
on_message(msgid, msgstr)
|
|
56
|
+
else
|
|
57
|
+
clear
|
|
58
|
+
end
|
|
56
59
|
result = ""
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -144,31 +147,26 @@ require "gettext/po"
|
|
|
144
147
|
@report_warning
|
|
145
148
|
end
|
|
146
149
|
|
|
147
|
-
def unescape(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
def unescape(string)
|
|
151
|
+
string.gsub(/\\(.)/) do
|
|
152
|
+
escaped_character = $1
|
|
153
|
+
case escaped_character
|
|
154
|
+
when "t"
|
|
155
|
+
"\t"
|
|
156
|
+
when "r"
|
|
157
|
+
"\r"
|
|
158
|
+
when "n"
|
|
159
|
+
"\n"
|
|
160
|
+
else
|
|
161
|
+
escaped_character
|
|
162
|
+
end
|
|
163
|
+
end
|
|
153
164
|
end
|
|
154
165
|
private :unescape
|
|
155
166
|
|
|
156
|
-
def unescape_string(string)
|
|
157
|
-
string.gsub(/\\\\/, "\\")
|
|
158
|
-
end
|
|
159
|
-
private :unescape_string
|
|
160
|
-
|
|
161
167
|
def parse(str, data)
|
|
162
|
-
|
|
163
|
-
@extracted_comments = []
|
|
164
|
-
@references = []
|
|
165
|
-
@flags = []
|
|
166
|
-
@previous = []
|
|
167
|
-
@comments = []
|
|
168
|
+
clear
|
|
168
169
|
@data = data
|
|
169
|
-
@fuzzy = false
|
|
170
|
-
@msgctxt = nil
|
|
171
|
-
@msgid_plural = nil
|
|
172
170
|
|
|
173
171
|
str = str.strip
|
|
174
172
|
@q = []
|
|
@@ -202,7 +200,7 @@ require "gettext/po"
|
|
|
202
200
|
@q.push [:COMMENT, $&]
|
|
203
201
|
str = $'
|
|
204
202
|
when /\A\"(.*)\"/
|
|
205
|
-
@q.push [:STRING,
|
|
203
|
+
@q.push [:STRING, unescape($1)]
|
|
206
204
|
str = $'
|
|
207
205
|
else
|
|
208
206
|
#c = str[0,1]
|
|
@@ -254,15 +252,7 @@ require "gettext/po"
|
|
|
254
252
|
@data.set_comment(msgid, format_comment(@comments))
|
|
255
253
|
end
|
|
256
254
|
|
|
257
|
-
|
|
258
|
-
@extracted_comments = []
|
|
259
|
-
@references = []
|
|
260
|
-
@flags = []
|
|
261
|
-
@previous = []
|
|
262
|
-
@references = []
|
|
263
|
-
@comments.clear
|
|
264
|
-
@msgctxt = nil
|
|
265
|
-
@msgid_plural = nil
|
|
255
|
+
clear
|
|
266
256
|
end
|
|
267
257
|
|
|
268
258
|
def format_comment(comments)
|
|
@@ -274,7 +264,11 @@ require "gettext/po"
|
|
|
274
264
|
end
|
|
275
265
|
|
|
276
266
|
def on_comment(comment)
|
|
277
|
-
|
|
267
|
+
if comment.start_with?(POFormat::FLAG_MARK)
|
|
268
|
+
content = comment[POFormat::FLAG_MARK.size..-1]
|
|
269
|
+
flags = parse_flags_line(content)
|
|
270
|
+
@fuzzy = flags.include?("fuzzy")
|
|
271
|
+
end
|
|
278
272
|
if @data.instance_of?(PO)
|
|
279
273
|
if comment == "#"
|
|
280
274
|
@translator_comments << ""
|
|
@@ -289,7 +283,7 @@ require "gettext/po"
|
|
|
289
283
|
when POFormat::REFERENCE_COMMENT_MARK
|
|
290
284
|
@references.concat(parse_references_line(content))
|
|
291
285
|
when POFormat::FLAG_MARK
|
|
292
|
-
@flags.concat(
|
|
286
|
+
@flags.concat(flags)
|
|
293
287
|
when POFormat::PREVIOUS_COMMENT_MARK
|
|
294
288
|
@previous << content
|
|
295
289
|
else
|
|
@@ -358,7 +352,19 @@ require "gettext/po"
|
|
|
358
352
|
end
|
|
359
353
|
|
|
360
354
|
def parse_flags_line(line)
|
|
361
|
-
line.split(
|
|
355
|
+
line.split(",").collect(&:strip)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def clear
|
|
359
|
+
@translator_comments = []
|
|
360
|
+
@extracted_comments = []
|
|
361
|
+
@references = []
|
|
362
|
+
@flags = []
|
|
363
|
+
@previous = []
|
|
364
|
+
@references = []
|
|
365
|
+
@comments = []
|
|
366
|
+
@msgctxt = nil
|
|
367
|
+
@msgid_plural = nil
|
|
362
368
|
end
|
|
363
369
|
---- footer
|
|
364
370
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (C) 2020 Kitaiti Makoto <KitaitiMakoto@gmail.com>
|
|
2
|
+
#
|
|
3
|
+
# License: Ruby's or LGPL
|
|
4
|
+
#
|
|
5
|
+
# This library is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
module Fixtures
|
|
19
|
+
module Method_
|
|
20
|
+
class Backtick
|
|
21
|
+
include GetText
|
|
22
|
+
|
|
23
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
24
|
+
|
|
25
|
+
def backtick
|
|
26
|
+
_(`echo hello world`)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2017 Kouhei
|
|
1
|
+
# Copyright (C) 2017-2020 Sutou Kouhei <kou@clear-code.com>
|
|
2
2
|
#
|
|
3
3
|
# License: Ruby's or LGPL
|
|
4
4
|
#
|
|
@@ -20,7 +20,7 @@ module Fixtures
|
|
|
20
20
|
class BlockParameter
|
|
21
21
|
include GetText
|
|
22
22
|
|
|
23
|
-
bindtextdomain("_", :path =>
|
|
23
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
24
24
|
|
|
25
25
|
def message
|
|
26
26
|
message_generator = lambda do |_|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class DoubleQuoteInDoubleQuote
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("double \"quote\" in double quote")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class DoubleQuoteInSingleQuote
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_('double "quote" in single quote')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class LiteralConcatenationWithContinuationLine
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("literal " \
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class MiddleNewLine
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("middle\nnew line")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class MultipleLinesLiteral
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("multiple
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class MultipleMessagesInSameLine
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("multiple") + " messages " + _("in same line")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class MultipleSameMessages
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("multiple same messages")
|
data/test/fixtures/_/one_line.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2012 Kouhei
|
|
3
|
+
# Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class OneLine
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("one line")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013 Kouhei
|
|
3
|
+
# Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# License: Ruby's or LGPL
|
|
6
6
|
#
|
|
@@ -22,7 +22,7 @@ module Fixtures
|
|
|
22
22
|
class OneNewLine
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("_", :path =>
|
|
25
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
_("one new line\n")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Copyright (C) 2020 Kitaiti Makoto <KitaitiMakoto@gmail.com>
|
|
2
|
+
# Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
|
|
3
|
+
#
|
|
4
|
+
# License: Ruby's or LGPL
|
|
5
|
+
#
|
|
6
|
+
# This library is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
module Fixtures
|
|
20
|
+
module Method_
|
|
21
|
+
class PercentStrings
|
|
22
|
+
include GetText
|
|
23
|
+
|
|
24
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
25
|
+
|
|
26
|
+
def symbol_array
|
|
27
|
+
_(%i(hello world))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def in_symbol_array
|
|
31
|
+
%I(before#{_("in_symbol_array")}after)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def symbol
|
|
35
|
+
_(%s(hello world))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def string
|
|
39
|
+
_(%(hello world))
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def string_array
|
|
43
|
+
_(%w(hello world))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def in_string_array
|
|
47
|
+
%W(before#{_("in_string_array")}after)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def execute
|
|
51
|
+
_(%x(echo hello world))
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|