gettext 3.0.6 → 3.0.7
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/doc/text/news.md +8 -0
- data/lib/gettext/tools/msginit.rb +51 -32
- data/lib/gettext/version.rb +1 -1
- 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/sv/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.po +32 -20
- data/po/bs/gettext.po +28 -16
- data/po/ca/gettext.po +32 -20
- data/po/cs/gettext.po +28 -16
- data/po/de/gettext.po +29 -17
- data/po/el/gettext.po +29 -17
- data/po/eo/gettext.po +29 -17
- data/po/es/gettext.po +29 -17
- data/po/et/gettext.po +29 -17
- data/po/fr/gettext.po +29 -17
- data/po/gettext.pot +32 -20
- data/po/hr/gettext.po +30 -18
- data/po/hu/gettext.po +29 -17
- data/po/it/gettext.po +32 -20
- data/po/ja/gettext.po +45 -40
- data/po/ko/gettext.po +30 -18
- data/po/lv/gettext.po +29 -17
- data/po/nb/gettext.po +29 -17
- data/po/nl/gettext.po +30 -18
- data/po/pt_BR/gettext.po +29 -17
- data/po/ru/gettext.po +29 -17
- data/po/sr/gettext.po +29 -17
- data/po/sv/gettext.po +32 -20
- data/po/uk/gettext.po +29 -17
- data/po/vi/gettext.po +29 -17
- data/po/zh/gettext.po +29 -17
- data/po/zh_TW/gettext.po +29 -17
- data/test/tools/test_msginit.rb +211 -245
- metadata +2 -2
data/po/zh_TW/gettext.po
CHANGED
|
@@ -11,7 +11,7 @@ msgid ""
|
|
|
11
11
|
msgstr ""
|
|
12
12
|
"Project-Id-Version: ruby-gettext 2.1.0\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: \n"
|
|
14
|
-
"POT-Creation-Date: 2014-02-
|
|
14
|
+
"POT-Creation-Date: 2014-02-09 21:39+0900\n"
|
|
15
15
|
"PO-Revision-Date: 2006-08-21 09:39+0800\n"
|
|
16
16
|
"Last-Translator: Yang Bob <bob.yang.dev at gmail.com>\n"
|
|
17
17
|
"Language-Team: zh_TW <xmarsh at gmail.com>\n"
|
|
@@ -28,7 +28,7 @@ msgstr ""
|
|
|
28
28
|
msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
|
|
29
29
|
msgstr "第三个参数錯誤:value = %{number}"
|
|
30
30
|
|
|
31
|
-
#: ../lib/gettext/text_domain_manager.rb:
|
|
31
|
+
#: ../lib/gettext/text_domain_manager.rb:155
|
|
32
32
|
msgid "ngettext: 3rd parameter should be a number, not nil."
|
|
33
33
|
msgstr ""
|
|
34
34
|
|
|
@@ -41,7 +41,7 @@ msgid "Concatenates and merges PO files."
|
|
|
41
41
|
msgstr ""
|
|
42
42
|
|
|
43
43
|
#: ../lib/gettext/tools/msgcat.rb:176 ../lib/gettext/tools/msgfmt.rb:86
|
|
44
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
44
|
+
#: ../lib/gettext/tools/msginit.rb:92 ../lib/gettext/tools/msgmerge.rb:329
|
|
45
45
|
#: ../lib/gettext/tools/xgettext.rb:248
|
|
46
46
|
msgid "Specific options:"
|
|
47
47
|
msgstr "特殊選項:"
|
|
@@ -123,32 +123,32 @@ msgstr "輸出到指定檔案"
|
|
|
123
123
|
msgid "display version information and exit"
|
|
124
124
|
msgstr "秀出版本資訊後退出"
|
|
125
125
|
|
|
126
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
126
|
+
#: ../lib/gettext/tools/msginit.rb:88
|
|
127
127
|
msgid ""
|
|
128
128
|
"Create a new .po file from initializing .pot file with user's environment and "
|
|
129
129
|
"input."
|
|
130
130
|
msgstr ""
|
|
131
131
|
|
|
132
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
132
|
+
#: ../lib/gettext/tools/msginit.rb:94
|
|
133
133
|
msgid ""
|
|
134
134
|
"Use INPUT as a .pot file. If INPUT is not specified, INPUT is a .pot file exis"
|
|
135
135
|
"ting the current directory."
|
|
136
136
|
msgstr ""
|
|
137
137
|
|
|
138
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
138
|
+
#: ../lib/gettext/tools/msginit.rb:101
|
|
139
139
|
msgid ""
|
|
140
140
|
"Use OUTPUT as a created .po file. If OUTPUT is not specified, OUTPUT depend on"
|
|
141
141
|
" LOCALE or the current locale on your environment."
|
|
142
142
|
msgstr ""
|
|
143
143
|
|
|
144
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
144
|
+
#: ../lib/gettext/tools/msginit.rb:108
|
|
145
145
|
msgid ""
|
|
146
146
|
"Use LOCALE as target locale. If LOCALE is not specified, LOCALE is the current"
|
|
147
147
|
" locale on your environment."
|
|
148
148
|
msgstr ""
|
|
149
149
|
|
|
150
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
151
|
-
msgid "
|
|
150
|
+
#: ../lib/gettext/tools/msginit.rb:116
|
|
151
|
+
msgid "Don't set translator information"
|
|
152
152
|
msgstr ""
|
|
153
153
|
|
|
154
154
|
#: ../lib/gettext/tools/msginit.rb:117
|
|
@@ -156,8 +156,16 @@ msgstr ""
|
|
|
156
156
|
msgid "Display version and exit"
|
|
157
157
|
msgstr "秀出版本資訊後退出"
|
|
158
158
|
|
|
159
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
160
|
-
msgid "
|
|
159
|
+
#: ../lib/gettext/tools/msginit.rb:121
|
|
160
|
+
msgid "Use NAME as translator name"
|
|
161
|
+
msgstr ""
|
|
162
|
+
|
|
163
|
+
#: ../lib/gettext/tools/msginit.rb:126
|
|
164
|
+
msgid "Use EMAIL as translator email address"
|
|
165
|
+
msgstr ""
|
|
166
|
+
|
|
167
|
+
#: ../lib/gettext/tools/msginit.rb:130 ../lib/gettext/tools/msgmerge.rb:398
|
|
168
|
+
msgid "Display this help and exit"
|
|
161
169
|
msgstr ""
|
|
162
170
|
|
|
163
171
|
#: ../lib/gettext/tools/msginit.rb:140
|
|
@@ -165,10 +173,8 @@ msgstr ""
|
|
|
165
173
|
msgid "file '%s' does not exist."
|
|
166
174
|
msgstr "檔案 '%s' 已經存在"
|
|
167
175
|
|
|
168
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
169
|
-
msgid ""
|
|
170
|
-
"\"Locale '#{language_tag}' is invalid. \"Please check if your specified locale i"
|
|
171
|
-
"s usable."
|
|
176
|
+
#: ../lib/gettext/tools/msginit.rb:153
|
|
177
|
+
msgid ".pot file does not exist in the current directory."
|
|
172
178
|
msgstr ""
|
|
173
179
|
|
|
174
180
|
#: ../lib/gettext/tools/msginit.rb:161
|
|
@@ -176,11 +182,17 @@ msgstr ""
|
|
|
176
182
|
msgid "file '%s' has already existed."
|
|
177
183
|
msgstr "檔案 '%s' 已經存在"
|
|
178
184
|
|
|
179
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
185
|
+
#: ../lib/gettext/tools/msginit.rb:170
|
|
186
|
+
msgid ""
|
|
187
|
+
"\"Locale '#{language_tag}' is invalid. \"Please check if your specified locale i"
|
|
188
|
+
"s usable."
|
|
189
|
+
msgstr ""
|
|
190
|
+
|
|
191
|
+
#: ../lib/gettext/tools/msginit.rb:221
|
|
180
192
|
msgid "Please enter your full name"
|
|
181
193
|
msgstr ""
|
|
182
194
|
|
|
183
|
-
#: ../lib/gettext/tools/msginit.rb:
|
|
195
|
+
#: ../lib/gettext/tools/msginit.rb:250
|
|
184
196
|
msgid "Please enter your email address"
|
|
185
197
|
msgstr ""
|
|
186
198
|
|
data/test/tools/test_msginit.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
3
|
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
|
4
|
-
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
|
4
|
+
# Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
|
|
5
5
|
#
|
|
6
6
|
# License: Ruby's or LGPL
|
|
7
7
|
#
|
|
@@ -23,8 +23,8 @@ require "gettext/tools/msginit"
|
|
|
23
23
|
class TestToolsMsgInit < Test::Unit::TestCase
|
|
24
24
|
def setup
|
|
25
25
|
@msginit = GetText::Tools::MsgInit.new
|
|
26
|
-
stub(@msginit).
|
|
27
|
-
stub(@msginit).
|
|
26
|
+
stub(@msginit).read_translator_name {translator_name}
|
|
27
|
+
stub(@msginit).read_translator_email {translator_email}
|
|
28
28
|
|
|
29
29
|
@year = "2012"
|
|
30
30
|
@po_revision_date = "2012-09-11 13:19+0900"
|
|
@@ -36,219 +36,10 @@ class TestToolsMsgInit < Test::Unit::TestCase
|
|
|
36
36
|
Locale.current = "ja_JP.UTF-8"
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def
|
|
40
|
-
Dir.mktmpdir do |dir|
|
|
41
|
-
pot_file_path = File.join(dir, "test.pot")
|
|
42
|
-
create_pot_file(pot_file_path)
|
|
43
|
-
po_file_path = File.join(dir, "test.po")
|
|
44
|
-
locale = "en"
|
|
45
|
-
language = locale
|
|
46
|
-
|
|
47
|
-
@msginit.run("--input", pot_file_path,
|
|
48
|
-
"--output", po_file_path,
|
|
49
|
-
"--locale", locale)
|
|
50
|
-
|
|
51
|
-
actual_po_header = File.read(po_file_path)
|
|
52
|
-
expected_po_header = po_header(locale, language)
|
|
53
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def test_locale_including_language
|
|
58
|
-
Dir.mktmpdir do |dir|
|
|
59
|
-
Dir.chdir(dir) do
|
|
60
|
-
create_pot_file("test.pot")
|
|
61
|
-
locale = "en"
|
|
62
|
-
language = locale
|
|
63
|
-
po_file_path = "#{locale}.po"
|
|
64
|
-
|
|
65
|
-
@msginit.run("--locale", locale)
|
|
66
|
-
|
|
67
|
-
actual_po_header = File.read(po_file_path)
|
|
68
|
-
expected_po_header = po_header(locale, language)
|
|
69
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def test_locale_including_language_and_region
|
|
75
|
-
Dir.mktmpdir do |dir|
|
|
76
|
-
Dir.chdir(dir) do
|
|
77
|
-
create_pot_file("test.pot")
|
|
78
|
-
locale = "en_US"
|
|
79
|
-
language = "en"
|
|
80
|
-
po_file_path = "#{locale}.po"
|
|
81
|
-
|
|
82
|
-
@msginit.run("--locale", locale)
|
|
83
|
-
|
|
84
|
-
actual_po_header = File.read(po_file_path)
|
|
85
|
-
expected_po_header = po_header(locale, language)
|
|
86
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def test_locale_including_language_and_region_with_charset
|
|
92
|
-
Dir.mktmpdir do |dir|
|
|
93
|
-
Dir.chdir(dir) do
|
|
94
|
-
create_pot_file("test.pot")
|
|
95
|
-
locale = "en_US"
|
|
96
|
-
language = "en"
|
|
97
|
-
charset = "UTF-8"
|
|
98
|
-
po_file_path = "en_US.po"
|
|
99
|
-
|
|
100
|
-
@msginit.run("--locale", "#{locale}.#{charset}")
|
|
101
|
-
|
|
102
|
-
actual_po_header = File.read(po_file_path)
|
|
103
|
-
expected_po_header = po_header(locale, language)
|
|
104
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
def test_pot_file_and_po_file
|
|
110
|
-
Dir.mktmpdir do |dir|
|
|
111
|
-
pot_file_path = File.join(dir, "test.pot")
|
|
112
|
-
create_pot_file(pot_file_path)
|
|
113
|
-
locale = current_locale
|
|
114
|
-
language = current_language
|
|
115
|
-
po_file_path = File.join(dir, "test.po")
|
|
116
|
-
|
|
117
|
-
@msginit.run("--input", pot_file_path, "--output", po_file_path)
|
|
118
|
-
|
|
119
|
-
actual_po_header = File.read(po_file_path)
|
|
120
|
-
expected_po_header = po_header(locale, language)
|
|
121
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def test_pot_file
|
|
126
|
-
Dir.mktmpdir do |dir|
|
|
127
|
-
Dir.chdir(dir) do
|
|
128
|
-
pot_file_path = "test.pot"
|
|
129
|
-
create_pot_file(pot_file_path)
|
|
130
|
-
locale = current_locale
|
|
131
|
-
language = current_language
|
|
132
|
-
po_file_path = "#{locale}.po"
|
|
133
|
-
|
|
134
|
-
@msginit.run("--input", pot_file_path)
|
|
135
|
-
|
|
136
|
-
actual_po_header = File.read(po_file_path)
|
|
137
|
-
expected_po_header = po_header(locale, language)
|
|
138
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def test_no_options
|
|
144
|
-
Dir.mktmpdir do |dir|
|
|
145
|
-
Dir.chdir(dir) do
|
|
146
|
-
create_pot_file("test.pot")
|
|
147
|
-
locale = current_locale
|
|
148
|
-
language = current_language
|
|
149
|
-
po_file_path = "#{locale}.po"
|
|
150
|
-
|
|
151
|
-
@msginit.run
|
|
152
|
-
|
|
153
|
-
actual_po_header = File.read(po_file_path)
|
|
154
|
-
expected_po_header = po_header(locale, language)
|
|
155
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
156
|
-
end
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def test_no_translator
|
|
161
|
-
stub(@msginit).read_translator_full_name {nil}
|
|
162
|
-
stub(@msginit).read_translator_mail {nil}
|
|
163
|
-
|
|
164
|
-
Dir.mktmpdir do |dir|
|
|
165
|
-
Dir.chdir(dir) do
|
|
166
|
-
create_pot_file("test.pot")
|
|
167
|
-
locale = current_locale
|
|
168
|
-
language = current_language
|
|
169
|
-
po_file_path = "#{locale}.po"
|
|
170
|
-
|
|
171
|
-
@msginit.run
|
|
172
|
-
|
|
173
|
-
actual_po_header = File.read(po_file_path)
|
|
174
|
-
expected_po_header = no_translator_po_header(locale, language)
|
|
175
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
def test_no_translator_full_name
|
|
181
|
-
stub(@msginit).read_translator_full_name {nil}
|
|
182
|
-
|
|
183
|
-
Dir.mktmpdir do |dir|
|
|
184
|
-
Dir.chdir(dir) do
|
|
185
|
-
create_pot_file("test.pot")
|
|
186
|
-
locale = current_locale
|
|
187
|
-
language = current_language
|
|
188
|
-
po_file_path = "#{locale}.po"
|
|
189
|
-
|
|
190
|
-
@msginit.run
|
|
191
|
-
|
|
192
|
-
actual_po_header = File.read(po_file_path)
|
|
193
|
-
expected_po_header = no_translator_po_header(locale, language)
|
|
194
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
def test_no_translator_mail
|
|
200
|
-
stub(@msginit).read_translator_mail {nil}
|
|
201
|
-
|
|
39
|
+
def run(*args, &blcok)
|
|
202
40
|
Dir.mktmpdir do |dir|
|
|
203
41
|
Dir.chdir(dir) do
|
|
204
|
-
|
|
205
|
-
locale = current_locale
|
|
206
|
-
language = current_language
|
|
207
|
-
po_file_path = "#{locale}.po"
|
|
208
|
-
|
|
209
|
-
@msginit.run
|
|
210
|
-
|
|
211
|
-
actual_po_header = File.read(po_file_path)
|
|
212
|
-
expected_po_header = no_translator_po_header(locale, language)
|
|
213
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
214
|
-
end
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
def test_package_name_specified_in_project_id_version
|
|
219
|
-
Dir.mktmpdir do |dir|
|
|
220
|
-
Dir.chdir(dir) do
|
|
221
|
-
pot_file_name = "test.pot"
|
|
222
|
-
options = {:package_name => "test-package"}
|
|
223
|
-
create_pot_file(pot_file_name, options)
|
|
224
|
-
locale = current_locale
|
|
225
|
-
language = current_language
|
|
226
|
-
po_file_path = "#{locale}.po"
|
|
227
|
-
|
|
228
|
-
@msginit.run("--input", pot_file_name)
|
|
229
|
-
|
|
230
|
-
expected_po_header = po_header(locale, language, options)
|
|
231
|
-
actual_po_header = File.read(po_file_path)
|
|
232
|
-
|
|
233
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
def test_no_plural_forms
|
|
238
|
-
Dir.mktmpdir do |dir|
|
|
239
|
-
Dir.chdir(dir) do
|
|
240
|
-
options = {:have_plural_forms => false}
|
|
241
|
-
create_pot_file("test.pot", options)
|
|
242
|
-
locale = current_locale
|
|
243
|
-
language = current_language
|
|
244
|
-
po_file_path = "#{locale}.po"
|
|
245
|
-
|
|
246
|
-
@msginit.run
|
|
247
|
-
|
|
248
|
-
actual_po_header = File.read(po_file_path)
|
|
249
|
-
expected_po_header = po_header(locale, language)
|
|
250
|
-
assert_equal(expected_po_header, actual_po_header)
|
|
251
|
-
end
|
|
42
|
+
super
|
|
252
43
|
end
|
|
253
44
|
end
|
|
254
45
|
end
|
|
@@ -262,11 +53,11 @@ class TestToolsMsgInit < Test::Unit::TestCase
|
|
|
262
53
|
Locale.current.language
|
|
263
54
|
end
|
|
264
55
|
|
|
265
|
-
def
|
|
56
|
+
def translator_name
|
|
266
57
|
"me"
|
|
267
58
|
end
|
|
268
59
|
|
|
269
|
-
def
|
|
60
|
+
def translator_email
|
|
270
61
|
"me@example.com"
|
|
271
62
|
end
|
|
272
63
|
|
|
@@ -277,7 +68,17 @@ class TestToolsMsgInit < Test::Unit::TestCase
|
|
|
277
68
|
end
|
|
278
69
|
end
|
|
279
70
|
|
|
71
|
+
def default_po_header_options
|
|
72
|
+
{
|
|
73
|
+
:package_name => default_package_name,
|
|
74
|
+
:first_translator_name => translator_name,
|
|
75
|
+
:translator_name => translator_name,
|
|
76
|
+
:translator_email => translator_email,
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
|
|
280
80
|
def pot_header(options)
|
|
81
|
+
options = default_po_header_options.merge(options)
|
|
281
82
|
package_name = options[:package_name] || default_package_name
|
|
282
83
|
have_plural_forms = options[:have_plural_forms] || true
|
|
283
84
|
header = <<EOF
|
|
@@ -305,11 +106,12 @@ EOF
|
|
|
305
106
|
header
|
|
306
107
|
end
|
|
307
108
|
|
|
308
|
-
def po_header(locale, language, options=
|
|
309
|
-
options
|
|
310
|
-
package_name = options[:package_name]
|
|
311
|
-
|
|
312
|
-
|
|
109
|
+
def po_header(locale, language, options={})
|
|
110
|
+
options = default_po_header_options.merge(options)
|
|
111
|
+
package_name = options[:package_name]
|
|
112
|
+
first_translator_name = options[:first_translator_name] || "FIRST AUTHOR"
|
|
113
|
+
name = options[:translator_name] || "FULL NAME"
|
|
114
|
+
email = options[:translator_email] || "EMAIL@ADDRESS"
|
|
313
115
|
language_name = Locale::Info.get_language(language).name
|
|
314
116
|
plural_forms = @msginit.send(:plural_forms, language)
|
|
315
117
|
|
|
@@ -317,14 +119,14 @@ EOF
|
|
|
317
119
|
# #{language_name} translations for #{package_name} package.
|
|
318
120
|
# Copyright (C) #{@year} THE PACKAGE'S COPYRIGHT HOLDER
|
|
319
121
|
# This file is distributed under the same license as the PACKAGE package.
|
|
320
|
-
# #{
|
|
122
|
+
# #{first_translator_name} <#{email}>, #{@year}.
|
|
321
123
|
#
|
|
322
124
|
msgid ""
|
|
323
125
|
msgstr ""
|
|
324
126
|
"Project-Id-Version: #{package_name} VERSION\\n"
|
|
325
127
|
"POT-Creation-Date: #{@pot_create_date}\\n"
|
|
326
128
|
"PO-Revision-Date: #{@po_revision_date}\\n"
|
|
327
|
-
"Last-Translator: #{
|
|
129
|
+
"Last-Translator: #{name} <#{email}>\\n"
|
|
328
130
|
"Language: #{locale}\\n"
|
|
329
131
|
"Language-Team: #{language_name}\\n"
|
|
330
132
|
"MIME-Version: 1.0\\n"
|
|
@@ -338,28 +140,192 @@ EOF
|
|
|
338
140
|
"PACKAGE"
|
|
339
141
|
end
|
|
340
142
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
143
|
+
class TestInput < self
|
|
144
|
+
def test_specify_option
|
|
145
|
+
pot_dir = "sub"
|
|
146
|
+
FileUtils.mkdir_p(pot_dir)
|
|
147
|
+
pot_file_path = File.join(pot_dir, "test.pot")
|
|
148
|
+
create_pot_file(pot_file_path)
|
|
149
|
+
@msginit.run("--input", pot_file_path)
|
|
150
|
+
po_file_path = "#{current_locale}.po"
|
|
151
|
+
assert_path_exist(po_file_path)
|
|
152
|
+
end
|
|
344
153
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
154
|
+
def test_find_pot
|
|
155
|
+
pot_in_current_directory = "test.pot"
|
|
156
|
+
create_pot_file(pot_in_current_directory)
|
|
157
|
+
@msginit.run
|
|
158
|
+
po_file_path = "#{current_locale}.po"
|
|
159
|
+
assert_path_exist(po_file_path)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def test_pot_not_found
|
|
163
|
+
pot_dir = "sub"
|
|
164
|
+
FileUtils.mkdir_p(pot_dir)
|
|
165
|
+
pot_file_path = File.join(pot_dir, "test.pot")
|
|
166
|
+
create_pot_file(pot_file_path)
|
|
167
|
+
|
|
168
|
+
assert_raise(GetText::Tools::MsgInit::ValidationError) do
|
|
169
|
+
@msginit.run
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
class TestOutput < self
|
|
175
|
+
def setup
|
|
176
|
+
super
|
|
177
|
+
@pot_file_path = "test.pot"
|
|
178
|
+
create_pot_file(@pot_file_path)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def test_default
|
|
182
|
+
@msginit.run("--input", @pot_file_path)
|
|
183
|
+
|
|
184
|
+
po_file_path = "#{current_locale}.po"
|
|
185
|
+
assert_path_exist(po_file_path)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def test_specify_option
|
|
189
|
+
po_dir = "sub"
|
|
190
|
+
FileUtils.mkdir_p(po_dir)
|
|
191
|
+
po_file_path = File.join(po_dir, "test.po")
|
|
192
|
+
|
|
193
|
+
@msginit.run("--input", @pot_file_path,
|
|
194
|
+
"--output", po_file_path)
|
|
195
|
+
|
|
196
|
+
assert_path_exist(po_file_path)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
class TestLocale < self
|
|
201
|
+
def run_msginit(locale)
|
|
202
|
+
create_pot_file("test.pot")
|
|
203
|
+
po_file_path = "output.po"
|
|
204
|
+
@msginit.run("--output", po_file_path,
|
|
205
|
+
"--locale", locale)
|
|
206
|
+
File.read(po_file_path)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def test_language
|
|
210
|
+
locale = "en"
|
|
211
|
+
assert_equal(po_header(locale, locale),
|
|
212
|
+
run_msginit(locale))
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_language_region
|
|
216
|
+
locale = "en_US"
|
|
217
|
+
language = "en"
|
|
218
|
+
assert_equal(po_header(locale, language),
|
|
219
|
+
run_msginit(locale))
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def test_language_region_charset
|
|
223
|
+
locale = "en_US"
|
|
224
|
+
language = "en"
|
|
225
|
+
charset = "UTF-8"
|
|
226
|
+
assert_equal(po_header(locale, language),
|
|
227
|
+
run_msginit("#{locale}.#{charset}"))
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
class TestTranslator < self
|
|
232
|
+
def run_msginit(*arguments)
|
|
233
|
+
create_pot_file("test.pot")
|
|
234
|
+
po_file_path = "output.po"
|
|
235
|
+
@msginit.run("--output", po_file_path,
|
|
236
|
+
*arguments)
|
|
237
|
+
File.read(po_file_path)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
class TestChanged < self
|
|
241
|
+
def po_header(options)
|
|
242
|
+
super(current_locale, current_language, options)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def test_name
|
|
246
|
+
name = "Custom Translator"
|
|
247
|
+
assert_equal(po_header(:first_translator_name => name,
|
|
248
|
+
:translator_name => name),
|
|
249
|
+
run_msginit("--translator-name", name))
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def test_email
|
|
253
|
+
email = "custom-translator@example.com"
|
|
254
|
+
assert_equal(po_header(:translator_email => email),
|
|
255
|
+
run_msginit("--translator-email", email))
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
class TestNotChanged < self
|
|
260
|
+
def no_translator_po_header
|
|
261
|
+
po_header(current_locale, current_language,
|
|
262
|
+
:first_translator_name => nil,
|
|
263
|
+
:translator_name => nil,
|
|
264
|
+
:translator_email => nil)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def test_no_name_no_email
|
|
268
|
+
stub(@msginit).read_translator_name {nil}
|
|
269
|
+
stub(@msginit).read_translator_email {nil}
|
|
270
|
+
|
|
271
|
+
assert_equal(no_translator_po_header,
|
|
272
|
+
run_msginit)
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
def test_no_name
|
|
276
|
+
stub(@msginit).read_translator_name {nil}
|
|
277
|
+
|
|
278
|
+
assert_equal(no_translator_po_header,
|
|
279
|
+
run_msginit)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def test_no_email
|
|
283
|
+
stub(@msginit).read_translator_email {nil}
|
|
284
|
+
|
|
285
|
+
assert_equal(no_translator_po_header,
|
|
286
|
+
run_msginit)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def test_no_translator
|
|
290
|
+
assert_equal(no_translator_po_header,
|
|
291
|
+
run_msginit("--no-translator"))
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
class TestPackage < self
|
|
297
|
+
def run_msginit
|
|
298
|
+
create_pot_file("test.pot")
|
|
299
|
+
po_file_path = "output.po"
|
|
300
|
+
@msginit.run("--output", po_file_path)
|
|
301
|
+
File.read(po_file_path)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
class TestCustomPackageName < self
|
|
305
|
+
def default_po_header_options
|
|
306
|
+
super.merge(:package_name => "test-package")
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
def test_not_change
|
|
310
|
+
assert_equal(po_header(current_locale, current_language),
|
|
311
|
+
run_msginit)
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
class TestPluralForms < self
|
|
317
|
+
def run_msginit(pot_header_options={})
|
|
318
|
+
create_pot_file("test.pot", pot_header_options)
|
|
319
|
+
po_file_path = "output.po"
|
|
320
|
+
@msginit.run("--output", po_file_path)
|
|
321
|
+
File.read(po_file_path)
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
class TestNoInPot < self
|
|
325
|
+
def test_no_plural_forms_in_pot
|
|
326
|
+
assert_equal(po_header(current_locale, current_language),
|
|
327
|
+
run_msginit(:have_plural_forms => false))
|
|
328
|
+
end
|
|
329
|
+
end
|
|
364
330
|
end
|
|
365
331
|
end
|