gettext 3.3.8 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/doc/text/news.md +50 -0
  3. data/gettext.gemspec +6 -5
  4. data/lib/gettext/mo.rb +5 -14
  5. data/lib/gettext/text_domain_manager.rb +6 -5
  6. data/lib/gettext/tools/msginit.rb +11 -6
  7. data/lib/gettext/version.rb +1 -1
  8. data/po/bg/gettext.edit.po +19 -19
  9. data/po/bs/gettext.edit.po +19 -19
  10. data/po/ca/gettext.edit.po +19 -19
  11. data/po/cs/gettext.edit.po +19 -19
  12. data/po/de/gettext.edit.po +19 -19
  13. data/po/el/gettext.edit.po +19 -19
  14. data/po/eo/gettext.edit.po +19 -19
  15. data/po/es/gettext.edit.po +19 -19
  16. data/po/et/gettext.edit.po +19 -19
  17. data/po/fr/gettext.edit.po +19 -19
  18. data/po/gettext.pot +22 -22
  19. data/po/hr/gettext.edit.po +19 -19
  20. data/po/hu/gettext.edit.po +19 -19
  21. data/po/it/gettext.edit.po +19 -19
  22. data/po/ja/gettext.edit.po +19 -19
  23. data/po/ko/gettext.edit.po +19 -19
  24. data/po/lv/gettext.edit.po +19 -19
  25. data/po/nb/gettext.edit.po +19 -19
  26. data/po/nl/gettext.edit.po +19 -19
  27. data/po/pt_BR/gettext.edit.po +19 -19
  28. data/po/ru/gettext.edit.po +19 -19
  29. data/po/sr/gettext.edit.po +19 -19
  30. data/po/sv/gettext.edit.po +19 -19
  31. data/po/uk/gettext.edit.po +19 -19
  32. data/po/vi/gettext.edit.po +19 -19
  33. data/po/zh/gettext.edit.po +19 -19
  34. data/po/zh_TW/gettext.edit.po +19 -19
  35. data/test/fixtures/simple.rb +4 -0
  36. data/test/locale/fr/LC_MESSAGES/test1.mo +0 -0
  37. data/test/locale/fr_BE/LC_MESSAGES/test1.mo +0 -0
  38. data/test/locale/fr_BE_Foo/LC_MESSAGES/test1.mo +0 -0
  39. data/test/po/fr/test1.po +7 -0
  40. data/test/po/fr_BE/test1.po +24 -0
  41. data/test/po/fr_BE_Foo/test1.po +20 -0
  42. data/test/test_gettext.rb +23 -0
  43. data/test/test_locale_path.rb +12 -4
  44. data/test/tools/test_msginit.rb +5 -0
  45. metadata +27 -8
@@ -20,12 +20,12 @@ msgstr ""
20
20
  "Content-Transfer-Encoding: 8bit\n"
21
21
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
22
22
 
23
- #: ../lib/gettext/text_domain_manager.rb:148
23
+ #: ../lib/gettext/text_domain_manager.rb:149
24
24
  #, fuzzy
25
25
  msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
26
26
  msgstr "Tham số thứ 3 sai: giá trị = %{number}"
27
27
 
28
- #: ../lib/gettext/text_domain_manager.rb:154
28
+ #: ../lib/gettext/text_domain_manager.rb:155
29
29
  msgid "ngettext: 3rd parameter should be a number, not nil."
30
30
  msgstr ""
31
31
 
@@ -37,7 +37,7 @@ msgstr ""
37
37
  msgid "Concatenates and merges PO files."
38
38
  msgstr ""
39
39
 
40
- #: ../lib/gettext/tools/msgcat.rb:246 ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:95 ../lib/gettext/tools/msgmerge.rb:369 ../lib/gettext/tools/xgettext.rb:248
40
+ #: ../lib/gettext/tools/msgcat.rb:246 ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:98 ../lib/gettext/tools/msgmerge.rb:369 ../lib/gettext/tools/xgettext.rb:248
41
41
  msgid "Specific options:"
42
42
  msgstr "Tùy chọn cụ thể:"
43
43
 
@@ -147,70 +147,70 @@ msgstr "ghi ra tập tin được chỉ định"
147
147
  msgid "display version information and exit"
148
148
  msgstr "hiện thông tin về phiên bản rồi thoát"
149
149
 
150
- #: ../lib/gettext/tools/msginit.rb:91
150
+ #: ../lib/gettext/tools/msginit.rb:94
151
151
  msgid "Create a new .po file from initializing .pot file with user's environment and input."
152
152
  msgstr ""
153
153
 
154
- #: ../lib/gettext/tools/msginit.rb:97
154
+ #: ../lib/gettext/tools/msginit.rb:100
155
155
  msgid "Use INPUT as a .pot file. If INPUT is not specified, INPUT is a .pot file existing the current directory."
156
156
  msgstr ""
157
157
 
158
- #: ../lib/gettext/tools/msginit.rb:104
158
+ #: ../lib/gettext/tools/msginit.rb:107
159
159
  msgid "Use OUTPUT as a created .po file. If OUTPUT is not specified, OUTPUT depend on LOCALE or the current locale on your environment."
160
160
  msgstr ""
161
161
 
162
- #: ../lib/gettext/tools/msginit.rb:111
162
+ #: ../lib/gettext/tools/msginit.rb:114
163
163
  msgid "Use LOCALE as target locale. If LOCALE is not specified, LOCALE is the current locale on your environment."
164
164
  msgstr ""
165
165
 
166
- #: ../lib/gettext/tools/msginit.rb:119
166
+ #: ../lib/gettext/tools/msginit.rb:122
167
167
  msgid "Whether set translator information or not"
168
168
  msgstr ""
169
169
 
170
- #: ../lib/gettext/tools/msginit.rb:120
170
+ #: ../lib/gettext/tools/msginit.rb:123
171
171
  msgid "(set)"
172
172
  msgstr ""
173
173
 
174
- #: ../lib/gettext/tools/msginit.rb:125
174
+ #: ../lib/gettext/tools/msginit.rb:128
175
175
  msgid "Use NAME as translator name"
176
176
  msgstr ""
177
177
 
178
- #: ../lib/gettext/tools/msginit.rb:130
178
+ #: ../lib/gettext/tools/msginit.rb:133
179
179
  msgid "Use EMAIL as translator email address"
180
180
  msgstr ""
181
181
 
182
- #: ../lib/gettext/tools/msginit.rb:134 ../lib/gettext/tools/msgmerge.rb:443
182
+ #: ../lib/gettext/tools/msginit.rb:137 ../lib/gettext/tools/msgmerge.rb:443
183
183
  msgid "Display this help and exit"
184
184
  msgstr ""
185
185
 
186
- #: ../lib/gettext/tools/msginit.rb:139
186
+ #: ../lib/gettext/tools/msginit.rb:142
187
187
  #, fuzzy
188
188
  msgid "Display version and exit"
189
189
  msgstr "hiện thông tin về phiên bản rồi thoát"
190
190
 
191
- #: ../lib/gettext/tools/msginit.rb:157
191
+ #: ../lib/gettext/tools/msginit.rb:160
192
192
  msgid ".pot file does not exist in the current directory."
193
193
  msgstr ""
194
194
 
195
- #: ../lib/gettext/tools/msginit.rb:162
195
+ #: ../lib/gettext/tools/msginit.rb:165
196
196
  #, fuzzy
197
197
  msgid "file '%s' does not exist."
198
198
  msgstr "Tập tin '%s' đã tồn tại."
199
199
 
200
- #: ../lib/gettext/tools/msginit.rb:174
200
+ #: ../lib/gettext/tools/msginit.rb:177
201
201
  msgid "Locale '%s' is invalid. Please check if your specified locale is usable."
202
202
  msgstr ""
203
203
 
204
- #: ../lib/gettext/tools/msginit.rb:184
204
+ #: ../lib/gettext/tools/msginit.rb:187
205
205
  #, fuzzy
206
206
  msgid "file '%s' has already existed."
207
207
  msgstr "Tập tin '%s' đã tồn tại."
208
208
 
209
- #: ../lib/gettext/tools/msginit.rb:226
209
+ #: ../lib/gettext/tools/msginit.rb:229
210
210
  msgid "Please enter your full name"
211
211
  msgstr ""
212
212
 
213
- #: ../lib/gettext/tools/msginit.rb:255
213
+ #: ../lib/gettext/tools/msginit.rb:258
214
214
  msgid "Please enter your email address"
215
215
  msgstr ""
216
216
 
@@ -23,12 +23,12 @@ msgstr ""
23
23
  "Plural-Forms: nplurals=1; plural=0;\n"
24
24
  "X-Generator: KBabel 1.9.1\n"
25
25
 
26
- #: ../lib/gettext/text_domain_manager.rb:148
26
+ #: ../lib/gettext/text_domain_manager.rb:149
27
27
  #, fuzzy
28
28
  msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
29
29
  msgstr "第三个参数错误:value = %{number}"
30
30
 
31
- #: ../lib/gettext/text_domain_manager.rb:154
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
 
@@ -40,7 +40,7 @@ msgstr ""
40
40
  msgid "Concatenates and merges PO files."
41
41
  msgstr ""
42
42
 
43
- #: ../lib/gettext/tools/msgcat.rb:246 ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:95 ../lib/gettext/tools/msgmerge.rb:369 ../lib/gettext/tools/xgettext.rb:248
43
+ #: ../lib/gettext/tools/msgcat.rb:246 ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:98 ../lib/gettext/tools/msgmerge.rb:369 ../lib/gettext/tools/xgettext.rb:248
44
44
  msgid "Specific options:"
45
45
  msgstr "具体选项:"
46
46
 
@@ -150,70 +150,70 @@ msgstr "输出到指定文件"
150
150
  msgid "display version information and exit"
151
151
  msgstr "显示版本信息并退出"
152
152
 
153
- #: ../lib/gettext/tools/msginit.rb:91
153
+ #: ../lib/gettext/tools/msginit.rb:94
154
154
  msgid "Create a new .po file from initializing .pot file with user's environment and input."
155
155
  msgstr ""
156
156
 
157
- #: ../lib/gettext/tools/msginit.rb:97
157
+ #: ../lib/gettext/tools/msginit.rb:100
158
158
  msgid "Use INPUT as a .pot file. If INPUT is not specified, INPUT is a .pot file existing the current directory."
159
159
  msgstr ""
160
160
 
161
- #: ../lib/gettext/tools/msginit.rb:104
161
+ #: ../lib/gettext/tools/msginit.rb:107
162
162
  msgid "Use OUTPUT as a created .po file. If OUTPUT is not specified, OUTPUT depend on LOCALE or the current locale on your environment."
163
163
  msgstr ""
164
164
 
165
- #: ../lib/gettext/tools/msginit.rb:111
165
+ #: ../lib/gettext/tools/msginit.rb:114
166
166
  msgid "Use LOCALE as target locale. If LOCALE is not specified, LOCALE is the current locale on your environment."
167
167
  msgstr ""
168
168
 
169
- #: ../lib/gettext/tools/msginit.rb:119
169
+ #: ../lib/gettext/tools/msginit.rb:122
170
170
  msgid "Whether set translator information or not"
171
171
  msgstr ""
172
172
 
173
- #: ../lib/gettext/tools/msginit.rb:120
173
+ #: ../lib/gettext/tools/msginit.rb:123
174
174
  msgid "(set)"
175
175
  msgstr ""
176
176
 
177
- #: ../lib/gettext/tools/msginit.rb:125
177
+ #: ../lib/gettext/tools/msginit.rb:128
178
178
  msgid "Use NAME as translator name"
179
179
  msgstr ""
180
180
 
181
- #: ../lib/gettext/tools/msginit.rb:130
181
+ #: ../lib/gettext/tools/msginit.rb:133
182
182
  msgid "Use EMAIL as translator email address"
183
183
  msgstr ""
184
184
 
185
- #: ../lib/gettext/tools/msginit.rb:134 ../lib/gettext/tools/msgmerge.rb:443
185
+ #: ../lib/gettext/tools/msginit.rb:137 ../lib/gettext/tools/msgmerge.rb:443
186
186
  msgid "Display this help and exit"
187
187
  msgstr ""
188
188
 
189
- #: ../lib/gettext/tools/msginit.rb:139
189
+ #: ../lib/gettext/tools/msginit.rb:142
190
190
  #, fuzzy
191
191
  msgid "Display version and exit"
192
192
  msgstr "显示版本信息并退出"
193
193
 
194
- #: ../lib/gettext/tools/msginit.rb:157
194
+ #: ../lib/gettext/tools/msginit.rb:160
195
195
  msgid ".pot file does not exist in the current directory."
196
196
  msgstr ""
197
197
 
198
- #: ../lib/gettext/tools/msginit.rb:162
198
+ #: ../lib/gettext/tools/msginit.rb:165
199
199
  #, fuzzy
200
200
  msgid "file '%s' does not exist."
201
201
  msgstr "文件'%s'已经存在。"
202
202
 
203
- #: ../lib/gettext/tools/msginit.rb:174
203
+ #: ../lib/gettext/tools/msginit.rb:177
204
204
  msgid "Locale '%s' is invalid. Please check if your specified locale is usable."
205
205
  msgstr ""
206
206
 
207
- #: ../lib/gettext/tools/msginit.rb:184
207
+ #: ../lib/gettext/tools/msginit.rb:187
208
208
  #, fuzzy
209
209
  msgid "file '%s' has already existed."
210
210
  msgstr "文件'%s'已经存在。"
211
211
 
212
- #: ../lib/gettext/tools/msginit.rb:226
212
+ #: ../lib/gettext/tools/msginit.rb:229
213
213
  msgid "Please enter your full name"
214
214
  msgstr ""
215
215
 
216
- #: ../lib/gettext/tools/msginit.rb:255
216
+ #: ../lib/gettext/tools/msginit.rb:258
217
217
  msgid "Please enter your email address"
218
218
  msgstr ""
219
219
 
@@ -22,12 +22,12 @@ msgstr ""
22
22
  "X-Poedit-Language: Chinese\n"
23
23
  "X-Poedit-Country: TAIWAN\n"
24
24
 
25
- #: ../lib/gettext/text_domain_manager.rb:148
25
+ #: ../lib/gettext/text_domain_manager.rb:149
26
26
  #, fuzzy
27
27
  msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
28
28
  msgstr "第三个参数錯誤:value = %{number}"
29
29
 
30
- #: ../lib/gettext/text_domain_manager.rb:154
30
+ #: ../lib/gettext/text_domain_manager.rb:155
31
31
  msgid "ngettext: 3rd parameter should be a number, not nil."
32
32
  msgstr ""
33
33
 
@@ -39,7 +39,7 @@ msgstr ""
39
39
  msgid "Concatenates and merges PO files."
40
40
  msgstr ""
41
41
 
42
- #: ../lib/gettext/tools/msgcat.rb:246 ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:95 ../lib/gettext/tools/msgmerge.rb:369 ../lib/gettext/tools/xgettext.rb:248
42
+ #: ../lib/gettext/tools/msgcat.rb:246 ../lib/gettext/tools/msgfmt.rb:86 ../lib/gettext/tools/msginit.rb:98 ../lib/gettext/tools/msgmerge.rb:369 ../lib/gettext/tools/xgettext.rb:248
43
43
  msgid "Specific options:"
44
44
  msgstr "特殊選項:"
45
45
 
@@ -149,70 +149,70 @@ msgstr "輸出到指定檔案"
149
149
  msgid "display version information and exit"
150
150
  msgstr "秀出版本資訊後退出"
151
151
 
152
- #: ../lib/gettext/tools/msginit.rb:91
152
+ #: ../lib/gettext/tools/msginit.rb:94
153
153
  msgid "Create a new .po file from initializing .pot file with user's environment and input."
154
154
  msgstr ""
155
155
 
156
- #: ../lib/gettext/tools/msginit.rb:97
156
+ #: ../lib/gettext/tools/msginit.rb:100
157
157
  msgid "Use INPUT as a .pot file. If INPUT is not specified, INPUT is a .pot file existing the current directory."
158
158
  msgstr ""
159
159
 
160
- #: ../lib/gettext/tools/msginit.rb:104
160
+ #: ../lib/gettext/tools/msginit.rb:107
161
161
  msgid "Use OUTPUT as a created .po file. If OUTPUT is not specified, OUTPUT depend on LOCALE or the current locale on your environment."
162
162
  msgstr ""
163
163
 
164
- #: ../lib/gettext/tools/msginit.rb:111
164
+ #: ../lib/gettext/tools/msginit.rb:114
165
165
  msgid "Use LOCALE as target locale. If LOCALE is not specified, LOCALE is the current locale on your environment."
166
166
  msgstr ""
167
167
 
168
- #: ../lib/gettext/tools/msginit.rb:119
168
+ #: ../lib/gettext/tools/msginit.rb:122
169
169
  msgid "Whether set translator information or not"
170
170
  msgstr ""
171
171
 
172
- #: ../lib/gettext/tools/msginit.rb:120
172
+ #: ../lib/gettext/tools/msginit.rb:123
173
173
  msgid "(set)"
174
174
  msgstr ""
175
175
 
176
- #: ../lib/gettext/tools/msginit.rb:125
176
+ #: ../lib/gettext/tools/msginit.rb:128
177
177
  msgid "Use NAME as translator name"
178
178
  msgstr ""
179
179
 
180
- #: ../lib/gettext/tools/msginit.rb:130
180
+ #: ../lib/gettext/tools/msginit.rb:133
181
181
  msgid "Use EMAIL as translator email address"
182
182
  msgstr ""
183
183
 
184
- #: ../lib/gettext/tools/msginit.rb:134 ../lib/gettext/tools/msgmerge.rb:443
184
+ #: ../lib/gettext/tools/msginit.rb:137 ../lib/gettext/tools/msgmerge.rb:443
185
185
  msgid "Display this help and exit"
186
186
  msgstr ""
187
187
 
188
- #: ../lib/gettext/tools/msginit.rb:139
188
+ #: ../lib/gettext/tools/msginit.rb:142
189
189
  #, fuzzy
190
190
  msgid "Display version and exit"
191
191
  msgstr "秀出版本資訊後退出"
192
192
 
193
- #: ../lib/gettext/tools/msginit.rb:157
193
+ #: ../lib/gettext/tools/msginit.rb:160
194
194
  msgid ".pot file does not exist in the current directory."
195
195
  msgstr ""
196
196
 
197
- #: ../lib/gettext/tools/msginit.rb:162
197
+ #: ../lib/gettext/tools/msginit.rb:165
198
198
  #, fuzzy
199
199
  msgid "file '%s' does not exist."
200
200
  msgstr "檔案 '%s' 已經存在"
201
201
 
202
- #: ../lib/gettext/tools/msginit.rb:174
202
+ #: ../lib/gettext/tools/msginit.rb:177
203
203
  msgid "Locale '%s' is invalid. Please check if your specified locale is usable."
204
204
  msgstr ""
205
205
 
206
- #: ../lib/gettext/tools/msginit.rb:184
206
+ #: ../lib/gettext/tools/msginit.rb:187
207
207
  #, fuzzy
208
208
  msgid "file '%s' has already existed."
209
209
  msgstr "檔案 '%s' 已經存在"
210
210
 
211
- #: ../lib/gettext/tools/msginit.rb:226
211
+ #: ../lib/gettext/tools/msginit.rb:229
212
212
  msgid "Please enter your full name"
213
213
  msgstr ""
214
214
 
215
- #: ../lib/gettext/tools/msginit.rb:255
215
+ #: ../lib/gettext/tools/msginit.rb:258
216
216
  msgid "Please enter your email address"
217
217
  msgstr ""
218
218
 
@@ -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
Binary file
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/test_gettext.rb CHANGED
@@ -59,6 +59,29 @@ class TestGetText < Test::Unit::TestCase
59
59
  assert_equal("nomsgstr", _("nomsgstr"))
60
60
  end
61
61
 
62
+ def test_fallbacks
63
+ bindtextdomain("test1", "locale")
64
+ test = Simple.new
65
+
66
+ # Translation present in all candidates
67
+ GetText.set_current_locale("fr_BE_Foo")
68
+ assert_equal("french-Belgium-Foo", test.test)
69
+ GetText.set_current_locale("fr_BE")
70
+ assert_equal("french-Belgium", test.test)
71
+ GetText.set_current_locale("fr")
72
+ assert_equal("french", test.test)
73
+
74
+ # Translation Missing in fr_BE_Foo (fallback to fr_BE)
75
+ GetText.set_current_locale("fr_BE_Foo")
76
+ assert_equal("FRENCH-BELGIUM:ONE IS 1.", test.test_formatted_string)
77
+
78
+ # Translation Missing in fr_BE_Foo *and* fr_BE (both languages fallback to fr)
79
+ GetText.set_current_locale("fr_BE_Foo")
80
+ assert_equal("FRENCH:Il y a 5 pommes.", test.test_plural)
81
+ GetText.set_current_locale("fr_BE")
82
+ assert_equal("FRENCH:Il y a 5 pommes.", test.test_plural)
83
+ end
84
+
62
85
  def test_empty
63
86
  bindtextdomain("test1", "locale")
64
87
  assert_equal("japanese", gettext("language"))
@@ -53,9 +53,11 @@ class TestLocalePath < Test::Unit::TestCase
53
53
  testdir = File.dirname(File.expand_path(__FILE__))
54
54
  path = GetText::LocalePath.new("test1", "#{testdir}/locale")
55
55
  assert_equal({
56
- "ja" => "#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
57
- "fr" => "#{testdir}/locale/fr/LC_MESSAGES/test1.mo",
58
- "zh_Hant" => "#{testdir}/locale/zh_Hant/LC_MESSAGES/test1.mo"
56
+ "ja" => "#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
57
+ "fr" => "#{testdir}/locale/fr/LC_MESSAGES/test1.mo",
58
+ "fr_BE" => "#{testdir}/locale/fr_BE/LC_MESSAGES/test1.mo",
59
+ "fr_BE_Foo" => "#{testdir}/locale/fr_BE_Foo/LC_MESSAGES/test1.mo",
60
+ "zh_Hant" => "#{testdir}/locale/zh_Hant/LC_MESSAGES/test1.mo"
59
61
  },
60
62
  path.locale_paths)
61
63
  assert_equal("#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
@@ -66,6 +68,12 @@ class TestLocalePath < Test::Unit::TestCase
66
68
  path.current_path(Locale::Tag.parse("ja_JP.UTF-8")))
67
69
  assert_equal(nil,
68
70
  path.current_path(Locale::Tag.parse("en")))
71
+ assert_equal("#{testdir}/locale/fr/LC_MESSAGES/test1.mo",
72
+ path.current_path(Locale::Tag.parse("fr")))
73
+ assert_equal("#{testdir}/locale/fr_BE/LC_MESSAGES/test1.mo",
74
+ path.current_path(Locale::Tag.parse("fr-BE")))
75
+ assert_equal("#{testdir}/locale/fr_BE_Foo/LC_MESSAGES/test1.mo",
76
+ path.current_path(Locale::Tag.parse("fr-BE-Foo")))
69
77
  assert_equal("#{testdir}/locale/zh_Hant/LC_MESSAGES/test1.mo",
70
78
  path.current_path(Locale::Tag.parse("zh-Hant")))
71
79
  end
@@ -73,7 +81,7 @@ class TestLocalePath < Test::Unit::TestCase
73
81
  def test_supported_locales
74
82
  testdir = File.dirname(File.expand_path(__FILE__))
75
83
  path = GetText::LocalePath.new("test1", "#{testdir}/locale")
76
- assert_equal ["fr", "ja", "zh_Hant"], path.supported_locales
84
+ assert_equal ["fr", "fr_BE", "fr_BE_Foo", "ja", "zh_Hant"], path.supported_locales
77
85
 
78
86
  path = GetText::LocalePath.new("plural", "#{testdir}/locale")
79
87
  assert_equal ["cr", "da", "fr", "ir", "ja", "la", "li", "po", "sl"], path.supported_locales
@@ -312,6 +312,11 @@ EOF
312
312
  end
313
313
 
314
314
  class TestPluralForms < self
315
+ def setup
316
+ super
317
+ omit("Red Datasets is required") unless defined?(Datasets::CLDRPlurals)
318
+ end
319
+
315
320
  def run_msginit(pot_header_options={})
316
321
  create_pot_file("test.pot", pot_header_options)
317
322
  po_file_path = "output.po"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.8
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-09 00:00:00.000000000 Z
12
+ date: 2022-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: locale
@@ -26,7 +26,7 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: 2.0.5
28
28
  - !ruby/object:Gem::Dependency
29
- name: red-datasets
29
+ name: prime
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.3.0
56
56
  - !ruby/object:Gem::Dependency
57
- name: rake
57
+ name: kramdown
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: yard
85
+ name: rake
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -96,7 +96,7 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
- name: kramdown
99
+ name: red-datasets
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
@@ -137,6 +137,20 @@ dependencies:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: yard
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
140
154
  description: |
141
155
  Gettext is a GNU gettext-like program for Ruby.
142
156
  The catalog file(po-file) is same format with GNU gettext.
@@ -1563,6 +1577,8 @@ files:
1563
1577
  - test/locale/fr/LC_MESSAGES/plural_error.mo
1564
1578
  - test/locale/fr/LC_MESSAGES/test1.mo
1565
1579
  - test/locale/fr/LC_MESSAGES/test2.mo
1580
+ - test/locale/fr_BE/LC_MESSAGES/test1.mo
1581
+ - test/locale/fr_BE_Foo/LC_MESSAGES/test1.mo
1566
1582
  - test/locale/ir/LC_MESSAGES/plural.mo
1567
1583
  - test/locale/ja/LC_MESSAGES/_.mo
1568
1584
  - test/locale/ja/LC_MESSAGES/backslash.mo
@@ -1595,6 +1611,8 @@ files:
1595
1611
  - test/po/fr/plural_error.po
1596
1612
  - test/po/fr/test1.po
1597
1613
  - test/po/fr/test2.po
1614
+ - test/po/fr_BE/test1.po
1615
+ - test/po/fr_BE_Foo/test1.po
1598
1616
  - test/po/hello.pot
1599
1617
  - test/po/ir/plural.po
1600
1618
  - test/po/ja/_.edit.po
@@ -1677,7 +1695,8 @@ files:
1677
1695
  - test/tools/test_xgettext.rb
1678
1696
  homepage: https://ruby-gettext.github.io/
1679
1697
  licenses:
1680
- - Ruby or LGPLv3+
1698
+ - Ruby
1699
+ - LGPL-3.0+
1681
1700
  metadata: {}
1682
1701
  post_install_message:
1683
1702
  rdoc_options: []
@@ -1694,7 +1713,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1694
1713
  - !ruby/object:Gem::Version
1695
1714
  version: '0'
1696
1715
  requirements: []
1697
- rubygems_version: 3.3.0.dev
1716
+ rubygems_version: 3.4.0.dev
1698
1717
  signing_key:
1699
1718
  specification_version: 4
1700
1719
  summary: Gettext is a pure Ruby libary and tools to localize messages.