gettext 3.3.8 → 3.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/Rakefile +1 -3
- data/doc/text/news.md +132 -0
- data/gettext.gemspec +7 -5
- data/lib/gettext/mo.rb +5 -14
- 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 +11 -6
- data/lib/gettext/tools/msgmerge.rb +11 -6
- data/lib/gettext/tools/parser/erubi.rb +88 -0
- 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/ja/LC_MESSAGES/gettext.mo +0 -0
- data/po/bg/gettext.edit.po +80 -75
- data/po/bg/gettext.po +6 -0
- data/po/bs/gettext.edit.po +80 -75
- data/po/bs/gettext.po +6 -0
- data/po/ca/gettext.edit.po +80 -75
- data/po/ca/gettext.po +6 -0
- data/po/cs/gettext.edit.po +80 -75
- data/po/cs/gettext.po +6 -0
- data/po/de/gettext.edit.po +80 -75
- data/po/de/gettext.po +6 -0
- data/po/el/gettext.edit.po +80 -75
- data/po/el/gettext.po +6 -0
- data/po/eo/gettext.edit.po +80 -75
- data/po/eo/gettext.po +6 -0
- data/po/es/gettext.edit.po +80 -75
- data/po/es/gettext.po +6 -0
- data/po/et/gettext.edit.po +80 -75
- data/po/et/gettext.po +6 -0
- data/po/fr/gettext.edit.po +80 -75
- data/po/fr/gettext.po +6 -0
- data/po/gettext.pot +92 -83
- data/po/hr/gettext.edit.po +80 -75
- data/po/hr/gettext.po +6 -0
- data/po/hu/gettext.edit.po +80 -75
- data/po/hu/gettext.po +6 -0
- data/po/it/gettext.edit.po +80 -75
- data/po/it/gettext.po +6 -0
- data/po/ja/gettext.edit.po +81 -76
- data/po/ja/gettext.po +7 -1
- data/po/ko/gettext.edit.po +80 -75
- data/po/ko/gettext.po +6 -0
- data/po/lv/gettext.edit.po +80 -75
- data/po/lv/gettext.po +6 -0
- data/po/nb/gettext.edit.po +80 -75
- data/po/nb/gettext.po +6 -0
- data/po/nl/gettext.edit.po +80 -75
- data/po/nl/gettext.po +6 -0
- data/po/pt_BR/gettext.edit.po +80 -75
- data/po/pt_BR/gettext.po +6 -0
- data/po/ru/gettext.edit.po +80 -75
- data/po/ru/gettext.po +6 -0
- data/po/sr/gettext.edit.po +80 -75
- data/po/sr/gettext.po +6 -0
- data/po/sv/gettext.edit.po +80 -72
- data/po/sv/gettext.po +6 -0
- data/po/uk/gettext.edit.po +80 -75
- data/po/uk/gettext.po +6 -0
- data/po/vi/gettext.edit.po +80 -75
- data/po/vi/gettext.po +6 -0
- data/po/zh/gettext.edit.po +80 -75
- data/po/zh/gettext.po +6 -0
- data/po/zh_TW/gettext.edit.po +80 -75
- data/po/zh_TW/gettext.po +6 -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/src/po_parser.ry +48 -42
- data/test/fixtures/erb/case.rhtml +16 -0
- data/test/fixtures/simple.rb +4 -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 +3 -3
- 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 +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_gettext.rb +23 -0
- data/test/test_locale_path.rb +12 -4
- data/test/test_parser.rb +62 -0
- data/test/test_po_entry.rb +20 -4
- data/test/test_po_parser.rb +44 -1
- data/test/tools/test_msgcat.rb +21 -1
- data/test/tools/test_msginit.rb +7 -2
- data/test/tools/test_msgmerge.rb +41 -3
- data/test/tools/test_xgettext.rb +100 -3
- metadata +49 -15
- data/test/fixtures/gtk_builder_ui_definitions.ui~ +0 -68
@@ -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/simple.rb
CHANGED
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"
|
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 ""
|
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"
|