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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Copyright (C) 2020 Sutou Kouhei <kou@clear-code.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 Pipe
|
|
21
|
+
include GetText
|
|
22
|
+
|
|
23
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
24
|
+
|
|
25
|
+
def binary_pipe
|
|
26
|
+
_("Hello")
|
|
27
|
+
1 | 2
|
|
28
|
+
_("World")
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
|
|
1
|
+
# Copyright (C) 2020 Kitaiti Makoto <KitaitiMakoto@gmail.com>
|
|
4
2
|
#
|
|
5
3
|
# License: Ruby's or LGPL
|
|
6
4
|
#
|
|
@@ -17,28 +15,20 @@
|
|
|
17
15
|
# You should have received a copy of the GNU Lesser General Public License
|
|
18
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
require "gettext"
|
|
26
|
-
|
|
27
|
-
module GetTextTestUtils
|
|
28
|
-
module_function
|
|
29
|
-
def fixture_path(*components)
|
|
30
|
-
File.join(File.dirname(__FILE__), "fixtures", *components)
|
|
31
|
-
end
|
|
18
|
+
module Fixtures
|
|
19
|
+
module Method_
|
|
20
|
+
class QuotedSymbol
|
|
21
|
+
include GetText
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
File.join(File.dirname(__FILE__), "locale")
|
|
35
|
-
end
|
|
23
|
+
bindtextdomain("_", :path => Helper::Path.locale_path)
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
def symbol_quoted_by_single_quote
|
|
26
|
+
_(:'hello world')
|
|
27
|
+
end
|
|
40
28
|
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
def symbol_quoted_by_double_quote
|
|
30
|
+
_(:"hello world")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
43
33
|
end
|
|
44
34
|
end
|
data/test/fixtures/_.rb
CHANGED
|
@@ -24,7 +24,7 @@ require 'gettext'
|
|
|
24
24
|
include GetText
|
|
25
25
|
|
|
26
26
|
class MessageFixture
|
|
27
|
-
bindtextdomain("rubyparser", :path =>
|
|
27
|
+
bindtextdomain("rubyparser", :path => Helper::Path.locale_path)
|
|
28
28
|
|
|
29
29
|
def test_1
|
|
30
30
|
_("aaa")
|
|
@@ -131,6 +131,15 @@ EOF
|
|
|
131
131
|
def test_includeing_sharp
|
|
132
132
|
_("This is a # including string.")
|
|
133
133
|
end
|
|
134
|
+
|
|
135
|
+
def test_regexp
|
|
136
|
+
/Regular Expression/
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def test_variable
|
|
140
|
+
message = "dynamic message"
|
|
141
|
+
_(message)
|
|
142
|
+
end
|
|
134
143
|
end
|
|
135
144
|
|
|
136
145
|
module ActionController
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- Generated with glade 3.38.2 -->
|
|
3
|
+
<interface>
|
|
4
|
+
<requires lib="gtk+" version="3.24"/>
|
|
5
|
+
<object class="GtkWindow">
|
|
6
|
+
<property name="can-focus">False</property>
|
|
7
|
+
<child>
|
|
8
|
+
<object class="GtkBox">
|
|
9
|
+
<property name="visible">True</property>
|
|
10
|
+
<property name="can-focus">False</property>
|
|
11
|
+
<property name="orientation">vertical</property>
|
|
12
|
+
<child>
|
|
13
|
+
<object class="GtkLabel">
|
|
14
|
+
<property name="visible">True</property>
|
|
15
|
+
<property name="can-focus">False</property>
|
|
16
|
+
<property name="label">untranslatable label</property>
|
|
17
|
+
</object>
|
|
18
|
+
<packing>
|
|
19
|
+
<property name="expand">False</property>
|
|
20
|
+
<property name="fill">True</property>
|
|
21
|
+
<property name="position">0</property>
|
|
22
|
+
</packing>
|
|
23
|
+
</child>
|
|
24
|
+
<child>
|
|
25
|
+
<object class="GtkLabel">
|
|
26
|
+
<property name="visible">True</property>
|
|
27
|
+
<property name="can-focus">False</property>
|
|
28
|
+
<property name="label" translatable="yes" comments="comment for translator">label with comment</property>
|
|
29
|
+
</object>
|
|
30
|
+
<packing>
|
|
31
|
+
<property name="expand">False</property>
|
|
32
|
+
<property name="fill">True</property>
|
|
33
|
+
<property name="position">1</property>
|
|
34
|
+
</packing>
|
|
35
|
+
</child>
|
|
36
|
+
<child>
|
|
37
|
+
<object class="GtkLabel">
|
|
38
|
+
<property name="visible">True</property>
|
|
39
|
+
<property name="can-focus">False</property>
|
|
40
|
+
<property name="label" translatable="yes">label without comment</property>
|
|
41
|
+
</object>
|
|
42
|
+
<packing>
|
|
43
|
+
<property name="expand">False</property>
|
|
44
|
+
<property name="fill">True</property>
|
|
45
|
+
<property name="position">2</property>
|
|
46
|
+
</packing>
|
|
47
|
+
</child>
|
|
48
|
+
<child>
|
|
49
|
+
<object class="GtkLabel">
|
|
50
|
+
<property name="visible">True</property>
|
|
51
|
+
<property name="can-focus">False</property>
|
|
52
|
+
<property name="label" translatable="yes" context="context">label with context</property>
|
|
53
|
+
</object>
|
|
54
|
+
<packing>
|
|
55
|
+
<property name="expand">False</property>
|
|
56
|
+
<property name="fill">True</property>
|
|
57
|
+
<property name="position">3</property>
|
|
58
|
+
</packing>
|
|
59
|
+
</child>
|
|
60
|
+
</object>
|
|
61
|
+
</child>
|
|
62
|
+
</object>
|
|
63
|
+
</interface>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- Generated with glade 3.22.1 -->
|
|
3
|
+
<interface>
|
|
4
|
+
<requires lib="gtk+" version="3.20"/>
|
|
5
|
+
<object class="GtkWindow">
|
|
6
|
+
<property name="can_focus">False</property>
|
|
7
|
+
<child>
|
|
8
|
+
<placeholder/>
|
|
9
|
+
</child>
|
|
10
|
+
<child>
|
|
11
|
+
<object class="GtkBox">
|
|
12
|
+
<property name="visible">True</property>
|
|
13
|
+
<property name="can_focus">False</property>
|
|
14
|
+
<property name="orientation">vertical</property>
|
|
15
|
+
<child>
|
|
16
|
+
<object class="GtkLabel">
|
|
17
|
+
<property name="visible">True</property>
|
|
18
|
+
<property name="can_focus">False</property>
|
|
19
|
+
<property name="label" translatable="yes" context="context" comments="comment">label with context</property>
|
|
20
|
+
</object>
|
|
21
|
+
<packing>
|
|
22
|
+
<property name="expand">False</property>
|
|
23
|
+
<property name="fill">True</property>
|
|
24
|
+
<property name="position">0</property>
|
|
25
|
+
</packing>
|
|
26
|
+
</child>
|
|
27
|
+
<child>
|
|
28
|
+
<object class="GtkLabel">
|
|
29
|
+
<property name="visible">True</property>
|
|
30
|
+
<property name="can_focus">False</property>
|
|
31
|
+
<property name="label" translatable="yes">label simple</property>
|
|
32
|
+
</object>
|
|
33
|
+
<packing>
|
|
34
|
+
<property name="expand">False</property>
|
|
35
|
+
<property name="fill">True</property>
|
|
36
|
+
<property name="position">1</property>
|
|
37
|
+
</packing>
|
|
38
|
+
</child>
|
|
39
|
+
<child>
|
|
40
|
+
<object class="GtkLabel">
|
|
41
|
+
<property name="visible">True</property>
|
|
42
|
+
<property name="can_focus">False</property>
|
|
43
|
+
<property name="label">not trnanslatable label</property>
|
|
44
|
+
</object>
|
|
45
|
+
<packing>
|
|
46
|
+
<property name="expand">False</property>
|
|
47
|
+
<property name="fill">True</property>
|
|
48
|
+
<property name="position">2</property>
|
|
49
|
+
</packing>
|
|
50
|
+
</child>
|
|
51
|
+
<child>
|
|
52
|
+
<object class="GtkLabel">
|
|
53
|
+
<property name="visible">True</property>
|
|
54
|
+
<property name="can_focus">False</property>
|
|
55
|
+
<property name="label" translatable="yes">multiple
|
|
56
|
+
lines
|
|
57
|
+
label</property>
|
|
58
|
+
</object>
|
|
59
|
+
<packing>
|
|
60
|
+
<property name="expand">False</property>
|
|
61
|
+
<property name="fill">True</property>
|
|
62
|
+
<property name="position">3</property>
|
|
63
|
+
</packing>
|
|
64
|
+
</child>
|
|
65
|
+
</object>
|
|
66
|
+
</child>
|
|
67
|
+
</object>
|
|
68
|
+
</interface>
|
|
@@ -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_/custom.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 Custom
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("ns_", :path =>
|
|
25
|
+
bindtextdomain("ns_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
ns_("context|context$message", "context|context$messages", 1, "$")
|
data/test/fixtures/ns_.rb
CHANGED
data/test/fixtures/p_.rb
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%i(hello world)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%w(Hello World)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%I(hello world)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%W(Hello World)
|
data/test/fixtures/s_/custom.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 Custom
|
|
23
23
|
include GetText
|
|
24
24
|
|
|
25
|
-
bindtextdomain("s_", :path =>
|
|
25
|
+
bindtextdomain("s_", :path => Helper::Path.locale_path)
|
|
26
26
|
|
|
27
27
|
def message
|
|
28
28
|
s_("context|context$message", "$")
|
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
|
|
@@ -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
|
+
|
data/test/helper.rb
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.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
|
+
require "fileutils"
|
|
19
|
+
require "tmpdir"
|
|
20
|
+
require "tempfile"
|
|
21
|
+
require "time"
|
|
22
|
+
|
|
23
|
+
require "gettext"
|
|
24
|
+
|
|
25
|
+
module Helper
|
|
26
|
+
module Path
|
|
27
|
+
module_function
|
|
28
|
+
def fixture_path(*components)
|
|
29
|
+
File.join(File.dirname(__FILE__), "fixtures", *components)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def locale_path
|
|
33
|
+
File.join(File.dirname(__FILE__), "locale")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module Tmpdir
|
|
38
|
+
def setup_tmpdir
|
|
39
|
+
@tmpdir = Dir.mktmpdir
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def teardown_tmpdir
|
|
43
|
+
FileUtils.rm_rf(@tmpdir, :secure => true) if @tmpdir
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
module Warning
|
|
48
|
+
def suppress_warning
|
|
49
|
+
stderr, $stderr = $stderr, StringIO.new
|
|
50
|
+
begin
|
|
51
|
+
yield
|
|
52
|
+
ensure
|
|
53
|
+
$stderr = stderr
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
module Parser
|
|
59
|
+
include Helper::Path
|
|
60
|
+
|
|
61
|
+
def assert_parse(expected, file)
|
|
62
|
+
assert_equal(normalize_expected(expected),
|
|
63
|
+
normalize_actual(parse(file)))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def normalize_expected(messages)
|
|
67
|
+
messages.collect do |message|
|
|
68
|
+
default = {
|
|
69
|
+
:msgid => nil,
|
|
70
|
+
:msgid_plural => nil,
|
|
71
|
+
:msgctxt => nil,
|
|
72
|
+
:msgstr => nil,
|
|
73
|
+
:separator => nil,
|
|
74
|
+
:references => nil,
|
|
75
|
+
}
|
|
76
|
+
default.merge(message)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def normalize_actual(po)
|
|
81
|
+
po.collect do |po_entry|
|
|
82
|
+
{
|
|
83
|
+
:msgid => po_entry.msgid,
|
|
84
|
+
:msgid_plural => po_entry.msgid_plural,
|
|
85
|
+
:msgctxt => po_entry.msgctxt,
|
|
86
|
+
:msgstr => po_entry.msgstr,
|
|
87
|
+
:separator => po_entry.separator,
|
|
88
|
+
:references => normalize_references(po_entry.references),
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def normalize_references(references)
|
|
94
|
+
references.collect do |reference|
|
|
95
|
+
reference.sub(/\A#{Regexp.escape(fixture_path)}\//, "")
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|