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
|
@@ -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 ""
|
|
@@ -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
|
|
data/test/fixtures/_.rb
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!-- Generated with glade 3.
|
|
2
|
+
<!-- Generated with glade 3.38.2 -->
|
|
3
3
|
<interface>
|
|
4
|
-
<requires lib="gtk+" version="3.
|
|
4
|
+
<requires lib="gtk+" version="3.24"/>
|
|
5
5
|
<object class="GtkWindow">
|
|
6
|
-
<property name="
|
|
7
|
-
<child>
|
|
8
|
-
<placeholder/>
|
|
9
|
-
</child>
|
|
6
|
+
<property name="can-focus">False</property>
|
|
10
7
|
<child>
|
|
11
8
|
<object class="GtkBox">
|
|
12
9
|
<property name="visible">True</property>
|
|
13
|
-
<property name="
|
|
10
|
+
<property name="can-focus">False</property>
|
|
14
11
|
<property name="orientation">vertical</property>
|
|
15
12
|
<child>
|
|
16
13
|
<object class="GtkLabel">
|
|
17
14
|
<property name="visible">True</property>
|
|
18
|
-
<property name="
|
|
19
|
-
<property name="label"
|
|
15
|
+
<property name="can-focus">False</property>
|
|
16
|
+
<property name="label">untranslatable label</property>
|
|
20
17
|
</object>
|
|
21
18
|
<packing>
|
|
22
19
|
<property name="expand">False</property>
|
|
@@ -27,8 +24,8 @@
|
|
|
27
24
|
<child>
|
|
28
25
|
<object class="GtkLabel">
|
|
29
26
|
<property name="visible">True</property>
|
|
30
|
-
<property name="
|
|
31
|
-
<property name="label" translatable="yes">label
|
|
27
|
+
<property name="can-focus">False</property>
|
|
28
|
+
<property name="label" translatable="yes" comments="comment for translator">label with comment</property>
|
|
32
29
|
</object>
|
|
33
30
|
<packing>
|
|
34
31
|
<property name="expand">False</property>
|
|
@@ -39,8 +36,8 @@
|
|
|
39
36
|
<child>
|
|
40
37
|
<object class="GtkLabel">
|
|
41
38
|
<property name="visible">True</property>
|
|
42
|
-
<property name="
|
|
43
|
-
<property name="label">
|
|
39
|
+
<property name="can-focus">False</property>
|
|
40
|
+
<property name="label" translatable="yes">label without comment</property>
|
|
44
41
|
</object>
|
|
45
42
|
<packing>
|
|
46
43
|
<property name="expand">False</property>
|
|
@@ -51,10 +48,8 @@
|
|
|
51
48
|
<child>
|
|
52
49
|
<object class="GtkLabel">
|
|
53
50
|
<property name="visible">True</property>
|
|
54
|
-
<property name="
|
|
55
|
-
<property name="label" translatable="yes">
|
|
56
|
-
lines
|
|
57
|
-
label</property>
|
|
51
|
+
<property name="can-focus">False</property>
|
|
52
|
+
<property name="label" translatable="yes" context="context">label with context</property>
|
|
58
53
|
</object>
|
|
59
54
|
<packing>
|
|
60
55
|
<property name="expand">False</property>
|
|
@@ -4,8 +4,8 @@ module MultiTextDomain
|
|
|
4
4
|
class C11
|
|
5
5
|
include GetText
|
|
6
6
|
def initialize
|
|
7
|
-
bindtextdomain("test1", :path =>
|
|
8
|
-
bindtextdomain("test2", :path =>
|
|
7
|
+
bindtextdomain("test1", :path => Helper::Path.locale_path)
|
|
8
|
+
bindtextdomain("test2", :path => Helper::Path.locale_path)
|
|
9
9
|
end
|
|
10
10
|
def test
|
|
11
11
|
_("language")
|
|
@@ -17,8 +17,8 @@ module MultiTextDomain
|
|
|
17
17
|
|
|
18
18
|
class C12
|
|
19
19
|
include GetText
|
|
20
|
-
bindtextdomain("test1", :path =>
|
|
21
|
-
bindtextdomain("test2", :path =>
|
|
20
|
+
bindtextdomain("test1", :path => Helper::Path.locale_path)
|
|
21
|
+
bindtextdomain("test2", :path => Helper::Path.locale_path)
|
|
22
22
|
|
|
23
23
|
def test
|
|
24
24
|
_("language")
|
|
@@ -36,7 +36,7 @@ module MultiTextDomain
|
|
|
36
36
|
|
|
37
37
|
module M1
|
|
38
38
|
include GetText
|
|
39
|
-
bindtextdomain("test1", :path =>
|
|
39
|
+
bindtextdomain("test1", :path => Helper::Path.locale_path)
|
|
40
40
|
|
|
41
41
|
module_function
|
|
42
42
|
def test
|
|
@@ -57,7 +57,7 @@ module MultiTextDomain
|
|
|
57
57
|
|
|
58
58
|
class M1C1
|
|
59
59
|
include GetText
|
|
60
|
-
bindtextdomain("test2", :path =>
|
|
60
|
+
bindtextdomain("test2", :path => Helper::Path.locale_path)
|
|
61
61
|
def test
|
|
62
62
|
_("language")
|
|
63
63
|
end
|
|
@@ -69,7 +69,7 @@ module MultiTextDomain
|
|
|
69
69
|
class M1C2
|
|
70
70
|
include GetText
|
|
71
71
|
def initialize
|
|
72
|
-
bindtextdomain("test2", :path =>
|
|
72
|
+
bindtextdomain("test2", :path => Helper::Path.locale_path)
|
|
73
73
|
end
|
|
74
74
|
def test
|
|
75
75
|
_("language")
|
|
@@ -84,7 +84,7 @@ module MultiTextDomain
|
|
|
84
84
|
class C2
|
|
85
85
|
include GetText
|
|
86
86
|
def initialize
|
|
87
|
-
bindtextdomain("test1", :path =>
|
|
87
|
+
bindtextdomain("test1", :path => Helper::Path.locale_path)
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def test
|
|
@@ -98,7 +98,7 @@ module MultiTextDomain
|
|
|
98
98
|
|
|
99
99
|
class C3
|
|
100
100
|
include GetText
|
|
101
|
-
bindtextdomain("test1", :path =>
|
|
101
|
+
bindtextdomain("test1", :path => Helper::Path.locale_path)
|
|
102
102
|
|
|
103
103
|
def test
|
|
104
104
|
_("language")
|
|
@@ -110,7 +110,7 @@ module MultiTextDomain
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
class C4 < C3
|
|
113
|
-
bindtextdomain("test2", :path =>
|
|
113
|
+
bindtextdomain("test2", :path => Helper::Path.locale_path)
|
|
114
114
|
|
|
115
115
|
def test2
|
|
116
116
|
_("LANGUAGE")
|
|
@@ -123,13 +123,13 @@ module MultiTextDomain
|
|
|
123
123
|
|
|
124
124
|
class C51
|
|
125
125
|
include GetText
|
|
126
|
-
bindtextdomain("test3", :path =>
|
|
126
|
+
bindtextdomain("test3", :path => Helper::Path.locale_path)
|
|
127
127
|
def test
|
|
128
128
|
_("language")
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
131
|
|
|
132
132
|
class C52 < C12
|
|
133
|
-
bindtextdomain("test3", :path =>
|
|
133
|
+
bindtextdomain("test3", :path => Helper::Path.locale_path)
|
|
134
134
|
end
|
|
135
135
|
end
|
data/test/fixtures/np_.rb
CHANGED
data/test/fixtures/ns_.rb
CHANGED
data/test/fixtures/p_.rb
CHANGED
data/test/fixtures/s_.rb
CHANGED
data/test/fixtures/simple.rb
CHANGED
|
@@ -4,7 +4,7 @@ require 'gettext'
|
|
|
4
4
|
|
|
5
5
|
class Simple
|
|
6
6
|
include GetText
|
|
7
|
-
bindtextdomain("test1", :path =>
|
|
7
|
+
bindtextdomain("test1", :path => Helper::Path.locale_path)
|
|
8
8
|
|
|
9
9
|
def test
|
|
10
10
|
_("language")
|
|
@@ -13,4 +13,8 @@ class Simple
|
|
|
13
13
|
def test_formatted_string
|
|
14
14
|
_("one is %d.") % 1
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
def test_plural
|
|
18
|
+
n_("There is an apple.", "There are %{num} apples.", 5) % {:num => 5}
|
|
19
|
+
end
|
|
16
20
|
end
|