gettext 2.1.0 → 2.2.0

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.
Files changed (148) hide show
  1. data/README.rdoc +10 -6
  2. data/Rakefile +15 -66
  3. data/data/locale/bg/LC_MESSAGES/rgettext.mo +0 -0
  4. data/data/locale/bs/LC_MESSAGES/rgettext.mo +0 -0
  5. data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -0
  6. data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
  7. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  8. data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
  9. data/data/locale/eo/LC_MESSAGES/rgettext.mo +0 -0
  10. data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
  11. data/data/locale/et/LC_MESSAGES/rgettext.mo +0 -0
  12. data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
  13. data/data/locale/hr/LC_MESSAGES/rgettext.mo +0 -0
  14. data/data/locale/hu/LC_MESSAGES/rgettext.mo +0 -0
  15. data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
  16. data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
  17. data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
  18. data/data/locale/lv/LC_MESSAGES/rgettext.mo +0 -0
  19. data/data/locale/nb/LC_MESSAGES/rgettext.mo +0 -0
  20. data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
  21. data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
  22. data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
  23. data/data/locale/sr/LC_MESSAGES/rgettext.mo +0 -0
  24. data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
  25. data/data/locale/uk/LC_MESSAGES/rgettext.mo +0 -0
  26. data/data/locale/vi/LC_MESSAGES/rgettext.mo +0 -0
  27. data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
  28. data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
  29. data/doc/text/news.md +30 -0
  30. data/gettext.gemspec +26 -34
  31. data/lib/gettext.rb +26 -24
  32. data/lib/gettext/cgi.rb +2 -0
  33. data/lib/gettext/core_ext/iconv.rb +7 -7
  34. data/lib/gettext/core_ext/string.rb +8 -6
  35. data/lib/gettext/parser/erb.rb +2 -0
  36. data/lib/gettext/parser/glade.rb +2 -0
  37. data/lib/gettext/parser/ruby.rb +12 -12
  38. data/lib/gettext/runtime/class_info.rb +5 -3
  39. data/lib/gettext/runtime/locale_path.rb +20 -22
  40. data/lib/gettext/runtime/mofile.rb +45 -18
  41. data/lib/gettext/runtime/textdomain.rb +6 -4
  42. data/lib/gettext/runtime/textdomain_group.rb +3 -1
  43. data/lib/gettext/runtime/textdomain_manager.rb +29 -26
  44. data/lib/gettext/tools.rb +15 -13
  45. data/lib/gettext/tools/parser/erb.rb +5 -3
  46. data/lib/gettext/tools/parser/glade.rb +16 -14
  47. data/lib/gettext/tools/parser/ruby.rb +16 -16
  48. data/lib/gettext/tools/pomessage.rb +9 -7
  49. data/lib/gettext/tools/poparser.rb +38 -36
  50. data/lib/gettext/tools/rgettext.rb +38 -13
  51. data/lib/gettext/tools/rmsgfmt.rb +7 -5
  52. data/lib/gettext/tools/rmsgmerge.rb +116 -114
  53. data/lib/gettext/utils.rb +2 -0
  54. data/lib/gettext/version.rb +3 -3
  55. data/po/bg/rgettext.po +17 -12
  56. data/po/bs/rgettext.po +16 -12
  57. data/po/ca/rgettext.po +17 -12
  58. data/po/cs/rgettext.po +16 -12
  59. data/po/de/rgettext.po +17 -12
  60. data/po/el/rgettext.po +17 -12
  61. data/po/eo/rgettext.po +17 -12
  62. data/po/es/rgettext.po +17 -12
  63. data/po/et/rgettext.po +17 -12
  64. data/po/fr/rgettext.po +17 -12
  65. data/po/hr/rgettext.po +19 -15
  66. data/po/hu/rgettext.po +17 -12
  67. data/po/it/rgettext.po +16 -12
  68. data/po/ja/rgettext.po +21 -15
  69. data/po/ko/rgettext.po +16 -12
  70. data/po/lv/rgettext.po +17 -12
  71. data/po/nb/rgettext.po +17 -12
  72. data/po/nl/rgettext.po +16 -12
  73. data/po/pt_BR/rgettext.po +17 -12
  74. data/po/rgettext.pot +16 -12
  75. data/po/ru/rgettext.po +17 -12
  76. data/po/sr/rgettext.po +17 -12
  77. data/po/sv/rgettext.po +16 -12
  78. data/po/{ua → uk}/rgettext.po +17 -12
  79. data/po/vi/rgettext.po +17 -12
  80. data/po/zh/rgettext.po +17 -12
  81. data/po/zh_TW/rgettext.po +17 -12
  82. data/samples/cgi/hellolib.rb +1 -1
  83. data/samples/cgi/http.rb +5 -5
  84. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/helloerb1.mo +0 -0
  85. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/helloerb2.mo +0 -0
  86. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/hellolib.mo +0 -0
  87. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/main.mo +0 -0
  88. data/samples/cgi/po/{ua → uk}/helloerb1.po +0 -0
  89. data/samples/cgi/po/{ua → uk}/helloerb2.po +0 -0
  90. data/samples/cgi/po/{ua → uk}/hellolib.po +0 -0
  91. data/samples/cgi/po/{ua → uk}/main.po +0 -0
  92. data/samples/hello.rb +1 -1
  93. data/samples/hello_gtk2.rb +1 -1
  94. data/samples/hello_noop.rb +1 -1
  95. data/samples/locale/{ua → uk}/LC_MESSAGES/hello.mo +0 -0
  96. data/samples/locale/{ua → uk}/LC_MESSAGES/hello2.mo +0 -0
  97. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_glade2.mo +0 -0
  98. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_gtk.mo +0 -0
  99. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_noop.mo +0 -0
  100. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_plural.mo +0 -0
  101. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_tk.mo +0 -0
  102. data/samples/makemo.rb +2 -0
  103. data/samples/po/test.rb +2 -0
  104. data/samples/po/{ua → uk}/hello.po +0 -0
  105. data/samples/po/{ua → uk}/hello2.po +0 -0
  106. data/samples/po/{ua → uk}/hello_glade2.po +0 -0
  107. data/samples/po/{ua → uk}/hello_gtk.po +0 -0
  108. data/samples/po/{ua → uk}/hello_noop.po +0 -0
  109. data/samples/po/{ua → uk}/hello_plural.po +0 -0
  110. data/samples/po/{ua → uk}/hello_tk.po +0 -0
  111. data/test/Rakefile +1 -1
  112. data/test/test_class_info.rb +5 -0
  113. data/test/test_gettext.rb +12 -1
  114. data/test/test_locale_path.rb +29 -3
  115. data/test/test_parser.rb +61 -59
  116. data/test/test_po_generation.rb +3 -1
  117. data/test/test_pomessage.rb +4 -2
  118. data/test/test_string.rb +2 -0
  119. data/test/test_textdomain_bind.rb +2 -0
  120. data/test/test_textdomain_multi.rb +2 -0
  121. data/test/test_textdomain_toplevel.rb +2 -0
  122. data/test/test_thread.rb +4 -2
  123. data/test/testlib/N_.rb +5 -3
  124. data/test/testlib/gettext.rb +4 -2
  125. data/test/testlib/helper.rb +2 -0
  126. data/test/testlib/multi_textdomain.rb +2 -0
  127. data/test/testlib/ngettext.rb +10 -8
  128. data/test/testlib/npgettext.rb +9 -7
  129. data/test/testlib/nsgettext.rb +4 -2
  130. data/test/testlib/pgettext.rb +4 -2
  131. data/test/testlib/sgettext.rb +4 -2
  132. data/test/testlib/simple.rb +2 -0
  133. data/test/tools/files/simple_translation.rb +3 -1
  134. data/test/tools/test_tools.rb +3 -1
  135. metadata +772 -737
  136. data/ChangeLog +0 -78
  137. data/ChangeLog-1 +0 -2016
  138. data/NEWS-1 +0 -414
  139. data/benchmark/1.93.0.txt +0 -8
  140. data/benchmark/2.0.0.txt +0 -8
  141. data/benchmark/2.0.4.txt +0 -11
  142. data/benchmark/2.1.0.txt +0 -11
  143. data/benchmark/benchmark.rb +0 -68
  144. data/benchmark/test.rb +0 -28
  145. data/data/locale/ua/LC_MESSAGES/rgettext.mo +0 -0
  146. data/replace.rb +0 -8
  147. data/samples/cgi/po/bg/#main.po# +0 -84
  148. data/test.rb +0 -33
data/po/vi/rgettext.po CHANGED
@@ -10,7 +10,7 @@
10
10
  msgid ""
11
11
  msgstr ""
12
12
  "Project-Id-Version: ruby-gettext 2.1.0\n"
13
- "POT-Creation-Date: 2009-11-08 22:43+0900\n"
13
+ "POT-Creation-Date: 2010-06-25 01:16+0900\n"
14
14
  "PO-Revision-Date: 2008-07-13 21:28+0900\n"
15
15
  "Last-Translator: Ngoc Dao <ngocdaothanh@gmail.com>\n"
16
16
  "Language-Team: Vietnamese\n"
@@ -33,17 +33,17 @@ msgstr ""
33
33
  "có chứa lời dịch. Tập tin ref.pot là tập tin PO được tạo ra lần trước có "
34
34
  "chứa tham chiếu mới nhất. ref.pot thường do rgettext tạo ra."
35
35
 
36
- #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:149
36
+ #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:176
37
37
  #: lib/gettext/tools/rmsgfmt.rb:50
38
38
  msgid "Specific options:"
39
39
  msgstr "Tùy chọn cụ thể:"
40
40
 
41
- #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:151
41
+ #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:178
42
42
  #: lib/gettext/tools/rmsgfmt.rb:52
43
43
  msgid "write output to specified file"
44
44
  msgstr "ghi ra tập tin được chỉ định"
45
45
 
46
- #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:168
46
+ #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:195
47
47
  #: lib/gettext/tools/rmsgfmt.rb:56
48
48
  msgid "display version information and exit"
49
49
  msgstr "hiện thông tin về phiên bản rồi thoát"
@@ -64,31 +64,31 @@ msgstr "`%{file}' không có định dạng là glade-2.0."
64
64
  msgid "'%{klass}' is ignored."
65
65
  msgstr "'%{klass}' đã được bỏ qua."
66
66
 
67
- #: lib/gettext/tools/rgettext.rb:134
67
+ #: lib/gettext/tools/rgettext.rb:161
68
68
  msgid "Error parsing %{path}"
69
69
  msgstr ""
70
70
 
71
- #: lib/gettext/tools/rgettext.rb:145
71
+ #: lib/gettext/tools/rgettext.rb:172
72
72
  msgid "Usage: %s input.rb [-r parser.rb] [-o output.pot]"
73
73
  msgstr "Cách sử dụng: %s input.rb [-r parser.rb] [-o output.pot]"
74
74
 
75
- #: lib/gettext/tools/rgettext.rb:147
75
+ #: lib/gettext/tools/rgettext.rb:174
76
76
  msgid "Extract translatable strings from given input files."
77
77
  msgstr "Trích chuỗi cần dịch từ những tập tin đầu vào."
78
78
 
79
- #: lib/gettext/tools/rgettext.rb:155
79
+ #: lib/gettext/tools/rgettext.rb:182
80
80
  msgid "File '%s' already exists."
81
81
  msgstr "Tập tin '%s' đã tồn tại."
82
82
 
83
- #: lib/gettext/tools/rgettext.rb:160
83
+ #: lib/gettext/tools/rgettext.rb:187
84
84
  msgid "require the library before executing rgettext"
85
85
  msgstr "require thư viện trước khi chạy rgettext"
86
86
 
87
- #: lib/gettext/tools/rgettext.rb:164
87
+ #: lib/gettext/tools/rgettext.rb:191
88
88
  msgid "run in debugging mode"
89
89
  msgstr "chạy trong chế độ debug"
90
90
 
91
- #: lib/gettext/tools/rgettext.rb:192 lib/gettext/tools/rmsgfmt.rb:29
91
+ #: lib/gettext/tools/rgettext.rb:218 lib/gettext/tools/rmsgfmt.rb:29
92
92
  msgid "no input files"
93
93
  msgstr "không có tập tin đầu vào"
94
94
 
@@ -120,9 +120,14 @@ msgid ""
120
120
  msgstr ""
121
121
 
122
122
  #: lib/gettext/runtime/textdomain_manager.rb:147
123
- msgid "3rd parmeter is wrong: value = %{number}"
123
+ #, fuzzy
124
+ msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
124
125
  msgstr "Tham số thứ 3 sai: giá trị = %{number}"
125
126
 
127
+ #: lib/gettext/runtime/textdomain_manager.rb:153
128
+ msgid "ngettext: 3rd parameter should be a number, not nil."
129
+ msgstr ""
130
+
126
131
  #: src/poparser.ry:38 src/poparser.ry:55
127
132
  msgid "Warning: fuzzy message was ignored.\n"
128
133
  msgstr "Cảnh báo: fuzzy message đã bị bỏ qua.\n"
data/po/zh/rgettext.po CHANGED
@@ -12,7 +12,7 @@
12
12
  msgid ""
13
13
  msgstr ""
14
14
  "Project-Id-Version: ruby-gettext 2.1.0\n"
15
- "POT-Creation-Date: 2009-11-08 22:43+0900\n"
15
+ "POT-Creation-Date: 2010-06-25 01:16+0900\n"
16
16
  "PO-Revision-Date: 2006-04-15 13:11+0300\n"
17
17
  "Last-Translator: Yang Bob <bob.yang.dev at gmail.com>\n"
18
18
  "Language-Team: Simplified Chinese\n"
@@ -35,17 +35,17 @@ msgstr ""
35
35
  "合并两个同样形式的 po 文件, def.po 是原來有翻译的文件,ref.pot 是经过原始码"
36
36
  "更新过的新文件,ref.pot 一般是由 rgettext 建立的。"
37
37
 
38
- #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:149
38
+ #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:176
39
39
  #: lib/gettext/tools/rmsgfmt.rb:50
40
40
  msgid "Specific options:"
41
41
  msgstr "具体选项:"
42
42
 
43
- #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:151
43
+ #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:178
44
44
  #: lib/gettext/tools/rmsgfmt.rb:52
45
45
  msgid "write output to specified file"
46
46
  msgstr "输出到指定文件"
47
47
 
48
- #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:168
48
+ #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:195
49
49
  #: lib/gettext/tools/rmsgfmt.rb:56
50
50
  msgid "display version information and exit"
51
51
  msgstr "显示版本信息并退出"
@@ -66,31 +66,31 @@ msgstr "`%{file}'不是glade-2.0格式。"
66
66
  msgid "'%{klass}' is ignored."
67
67
  msgstr "'%{klass}'被忽略。"
68
68
 
69
- #: lib/gettext/tools/rgettext.rb:134
69
+ #: lib/gettext/tools/rgettext.rb:161
70
70
  msgid "Error parsing %{path}"
71
71
  msgstr ""
72
72
 
73
- #: lib/gettext/tools/rgettext.rb:145
73
+ #: lib/gettext/tools/rgettext.rb:172
74
74
  msgid "Usage: %s input.rb [-r parser.rb] [-o output.pot]"
75
75
  msgstr "使用方法:%s input.rb [-r parser.rb] [-o output.pot]"
76
76
 
77
- #: lib/gettext/tools/rgettext.rb:147
77
+ #: lib/gettext/tools/rgettext.rb:174
78
78
  msgid "Extract translatable strings from given input files."
79
79
  msgstr "从给定输入文件中提取翻译字符串。"
80
80
 
81
- #: lib/gettext/tools/rgettext.rb:155
81
+ #: lib/gettext/tools/rgettext.rb:182
82
82
  msgid "File '%s' already exists."
83
83
  msgstr "文件'%s'已经存在。"
84
84
 
85
- #: lib/gettext/tools/rgettext.rb:160
85
+ #: lib/gettext/tools/rgettext.rb:187
86
86
  msgid "require the library before executing rgettext"
87
87
  msgstr "在执行 rgettext 之前需要一个库"
88
88
 
89
- #: lib/gettext/tools/rgettext.rb:164
89
+ #: lib/gettext/tools/rgettext.rb:191
90
90
  msgid "run in debugging mode"
91
91
  msgstr "运行于调试模式"
92
92
 
93
- #: lib/gettext/tools/rgettext.rb:192 lib/gettext/tools/rmsgfmt.rb:29
93
+ #: lib/gettext/tools/rgettext.rb:218 lib/gettext/tools/rmsgfmt.rb:29
94
94
  msgid "no input files"
95
95
  msgstr "没有输入文件"
96
96
 
@@ -121,9 +121,14 @@ msgid ""
121
121
  msgstr ""
122
122
 
123
123
  #: lib/gettext/runtime/textdomain_manager.rb:147
124
- msgid "3rd parmeter is wrong: value = %{number}"
124
+ #, fuzzy
125
+ msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
125
126
  msgstr "第三个参数错误:value = %{number}"
126
127
 
128
+ #: lib/gettext/runtime/textdomain_manager.rb:153
129
+ msgid "ngettext: 3rd parameter should be a number, not nil."
130
+ msgstr ""
131
+
127
132
  #: src/poparser.ry:38 src/poparser.ry:55
128
133
  msgid "Warning: fuzzy message was ignored.\n"
129
134
  msgstr "警告:不明确信息(fuzzy message)已被忽略。"
data/po/zh_TW/rgettext.po CHANGED
@@ -10,7 +10,7 @@
10
10
  msgid ""
11
11
  msgstr ""
12
12
  "Project-Id-Version: ruby-gettext 2.1.0\n"
13
- "POT-Creation-Date: 2009-11-08 22:43+0900\n"
13
+ "POT-Creation-Date: 2010-06-25 01:16+0900\n"
14
14
  "PO-Revision-Date: 2006-08-21 09:39+0800\n"
15
15
  "Last-Translator: Yang Bob <bob.yang.dev at gmail.com>\n"
16
16
  "Language-Team: zh_TW <xmarsh at gmail.com>\n"
@@ -34,17 +34,17 @@ msgstr ""
34
34
  "合併兩同樣形式的 po 檔, def.po 檔是原來有翻譯的檔案,ref.pot 檔是經過原始碼"
35
35
  "更新過的新檔,ref.pot 一般是由rgettext 建立。"
36
36
 
37
- #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:149
37
+ #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:176
38
38
  #: lib/gettext/tools/rmsgfmt.rb:50
39
39
  msgid "Specific options:"
40
40
  msgstr "特殊選項:"
41
41
 
42
- #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:151
42
+ #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:178
43
43
  #: lib/gettext/tools/rmsgfmt.rb:52
44
44
  msgid "write output to specified file"
45
45
  msgstr "輸出到指定檔案"
46
46
 
47
- #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:168
47
+ #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:195
48
48
  #: lib/gettext/tools/rmsgfmt.rb:56
49
49
  msgid "display version information and exit"
50
50
  msgstr "秀出版本資訊後退出"
@@ -65,31 +65,31 @@ msgstr "`%{file}' 不是 glade-2.0 格式"
65
65
  msgid "'%{klass}' is ignored."
66
66
  msgstr "'%{klass}' 忽略"
67
67
 
68
- #: lib/gettext/tools/rgettext.rb:134
68
+ #: lib/gettext/tools/rgettext.rb:161
69
69
  msgid "Error parsing %{path}"
70
70
  msgstr ""
71
71
 
72
- #: lib/gettext/tools/rgettext.rb:145
72
+ #: lib/gettext/tools/rgettext.rb:172
73
73
  msgid "Usage: %s input.rb [-r parser.rb] [-o output.pot]"
74
74
  msgstr "使用: %s input.rb [-r parser.rb] [-o output.pot]"
75
75
 
76
- #: lib/gettext/tools/rgettext.rb:147
76
+ #: lib/gettext/tools/rgettext.rb:174
77
77
  msgid "Extract translatable strings from given input files."
78
78
  msgstr "從輸入檔中取出翻譯字串"
79
79
 
80
- #: lib/gettext/tools/rgettext.rb:155
80
+ #: lib/gettext/tools/rgettext.rb:182
81
81
  msgid "File '%s' already exists."
82
82
  msgstr "檔案 '%s' 已經存在"
83
83
 
84
- #: lib/gettext/tools/rgettext.rb:160
84
+ #: lib/gettext/tools/rgettext.rb:187
85
85
  msgid "require the library before executing rgettext"
86
86
  msgstr "在執行 rgettext 之前需要一個庫"
87
87
 
88
- #: lib/gettext/tools/rgettext.rb:164
88
+ #: lib/gettext/tools/rgettext.rb:191
89
89
  msgid "run in debugging mode"
90
90
  msgstr "執行除錯模式"
91
91
 
92
- #: lib/gettext/tools/rgettext.rb:192 lib/gettext/tools/rmsgfmt.rb:29
92
+ #: lib/gettext/tools/rgettext.rb:218 lib/gettext/tools/rmsgfmt.rb:29
93
93
  msgid "no input files"
94
94
  msgstr "無輸入檔"
95
95
 
@@ -120,9 +120,14 @@ msgid ""
120
120
  msgstr ""
121
121
 
122
122
  #: lib/gettext/runtime/textdomain_manager.rb:147
123
- msgid "3rd parmeter is wrong: value = %{number}"
123
+ #, fuzzy
124
+ msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
124
125
  msgstr "第三个参数錯誤:value = %{number}"
125
126
 
127
+ #: lib/gettext/runtime/textdomain_manager.rb:153
128
+ msgid "ngettext: 3rd parameter should be a number, not nil."
129
+ msgstr ""
130
+
126
131
  #: src/poparser.ry:38 src/poparser.ry:55
127
132
  msgid "Warning: fuzzy message was ignored.\n"
128
133
  msgstr "警告: fuzzy 訊息被忽略\n"
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Copyright (C) 2005-2009 Masao Mutoh
5
5
  #
6
- # This file is distributed under the same
6
+ # This file is distributed under the same
7
7
  # license as Ruby-GetText-Package.
8
8
  #
9
9
 
data/samples/cgi/http.rb CHANGED
@@ -13,16 +13,16 @@ require 'cgi'
13
13
  require 'rbconfig'
14
14
 
15
15
  interpreter = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) +
16
- Config::CONFIG['EXEEXT']
16
+ Config::CONFIG['EXEEXT']
17
17
 
18
18
  srv = WEBrick::HTTPServer.new({:BindAddress => '127.0.0.1',
19
19
  :Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG),
20
- :CGIInterpreter => interpreter,
21
- # :CGIInterpreter => "ruby -d",
22
- :Port => 10080})
20
+ :CGIInterpreter => interpreter,
21
+ # :CGIInterpreter => "ruby -d",
22
+ :Port => 10080})
23
23
 
24
24
  ['INT', 'TERM'].each { |signal|
25
- trap(signal){ srv.shutdown}
25
+ trap(signal){ srv.shutdown}
26
26
  }
27
27
 
28
28
  srv.mount("/", WEBrick::HTTPServlet::FileHandler, File.expand_path('.'))
File without changes
File without changes
File without changes
File without changes
File without changes
data/samples/hello.rb CHANGED
@@ -21,7 +21,7 @@ if __FILE__ == $0
21
21
  a = HelloWorld.new
22
22
 
23
23
  a.hello # Show in your locale
24
-
24
+
25
25
  old = GetText.locale
26
26
  p old.to_s # Show current locale
27
27
 
@@ -11,7 +11,7 @@ require 'gtk2'
11
11
  class LocalizedWindow < Gtk::Window
12
12
  include GetText
13
13
 
14
- bindtextdomain("hello_gtk", :path => "locale", :output_charset => "utf-8")
14
+ bindtextdomain("hello_gtk", :path => "locale", :output_charset => "utf-8")
15
15
 
16
16
  def initialize
17
17
  super
@@ -14,7 +14,7 @@ class HelloNoop
14
14
 
15
15
  def initialize
16
16
  # You can call bindtextdomain as instance methods.
17
- # In this case, it initializes(decided the locale lazily)
17
+ # In this case, it initializes(decided the locale lazily)
18
18
  # in a instance.
19
19
  bindtextdomain("hello_noop", :path => "locale")
20
20
  end
File without changes
File without changes
File without changes
File without changes
File without changes
data/samples/makemo.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'rubygems'
2
4
  require 'gettext/tools'
3
5
 
data/samples/po/test.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  filename, to = ARGV
2
4
  p filename
3
5
  p to
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/test/Rakefile CHANGED
@@ -12,6 +12,6 @@ desc 'Run all tests'
12
12
  task :test do
13
13
  Dir.glob("**/test_*.rb").each do |path|
14
14
  puts ""
15
- ruby "-I../lib:../../locale/lib -rubygems #{path}"
15
+ ruby "-I../lib:../../locale/lib:. -rubygems #{path}"
16
16
  end
17
17
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'testlib/helper.rb'
2
4
  require 'gettext/runtime/class_info'
3
5
 
@@ -80,4 +82,7 @@ class TestClassInfo < Test::Unit::TestCase
80
82
  assert_equal [M8, M8::M9, Object], related_classes(M8)
81
83
  end
82
84
 
85
+ def test_ruby19
86
+ assert_equal Object, GetText::ClassInfo.normalize_class(Module.new)
87
+ end
83
88
  end
data/test/test_gettext.rb CHANGED
@@ -110,10 +110,14 @@ DDD
110
110
  assert_equal(["a picture", "%{num} pictures"], test.test_5)
111
111
  end
112
112
 
113
- def test_n_defaults_to_1_when_number_is_missing
113
+ def test_ngettext_defaults_to_1_when_number_is_missing
114
114
  assert_equal n_("aaa","aaa2",1), "aaa"
115
115
  end
116
116
 
117
+ def test_ngettext_format_error
118
+ assert_raise(ArgumentError) { n_("aaa", "aaa2") }
119
+ end
120
+
117
121
  def test_nsgettext
118
122
  GetText.locale = nil
119
123
  test = TestNSGetText.new
@@ -308,4 +312,11 @@ DDD
308
312
  assert(GetText._("language").frozen?)
309
313
  end
310
314
 
315
+ def test_safe_mode
316
+ Thread.start{
317
+ $SAFE = 1
318
+ GetText.bindtextdomain("test1", :path => "locale")
319
+ _("language")
320
+ }.join
321
+ end
311
322
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'testlib/helper.rb'
2
4
  require 'testlib/simple'
3
5
 
@@ -14,8 +16,8 @@ class TestLocalePath < Test::Unit::TestCase
14
16
  default_locale_dirs = [
15
17
  "./locale/%{lang}/LC_MESSAGES/%{name}.mo",
16
18
  "./locale/%{lang}/%{name}.mo",
17
- "#{Config::CONFIG['datadir']}/locale/%{lang}/LC_MESSAGES/%{name}.mo",
18
- "#{Config::CONFIG['datadir'].gsub(/\/local/, "")}/locale/%{lang}/LC_MESSAGES/%{name}.mo",
19
+ "#{RbConfig::CONFIG['datadir']}/locale/%{lang}/LC_MESSAGES/%{name}.mo",
20
+ "#{RbConfig::CONFIG['datadir'].gsub(/\/local/, "")}/locale/%{lang}/LC_MESSAGES/%{name}.mo",
19
21
  "#{prefix}/share/locale/%{lang}/LC_MESSAGES/%{name}.mo",
20
22
  "#{prefix}/local/share/locale/%{lang}/LC_MESSAGES/%{name}.mo"
21
23
  ].uniq
@@ -28,7 +30,7 @@ class TestLocalePath < Test::Unit::TestCase
28
30
  def test_initialize_with_topdir
29
31
  testdir = File.dirname(File.expand_path(__FILE__))
30
32
  path = GetText::LocalePath.new("test1", "#{testdir}/locale")
31
- assert_equal path.locale_paths, { "ja" => "#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
33
+ assert_equal path.locale_paths, { "ja" => "#{testdir}/locale/ja/LC_MESSAGES/test1.mo",
32
34
  "fr" => "#{testdir}/locale/fr/LC_MESSAGES/test1.mo"}
33
35
  assert_equal path.current_path(Locale::Tag.parse("ja")), "#{testdir}/locale/ja/LC_MESSAGES/test1.mo"
34
36
  assert_equal path.current_path(Locale::Tag.parse("ja-JP")), "#{testdir}/locale/ja/LC_MESSAGES/test1.mo"
@@ -47,4 +49,28 @@ class TestLocalePath < Test::Unit::TestCase
47
49
  path = GetText::LocalePath.new("nodomain", "#{testdir}/locale")
48
50
  assert_equal [], path.supported_locales
49
51
  end
52
+
53
+ def test_env_GETTEXT_PATH
54
+ topdir = File.join(File.dirname(File.expand_path(__FILE__)), "../samples")
55
+ path1 = File.join(topdir, "locale")
56
+ path2 = File.join(topdir, "cgi", "locale")
57
+
58
+ GetText::LocalePath.memoize_clear
59
+ ENV["GETTEXT_PATH"] = path1
60
+ default_path_rules = GetText::LocalePath.default_path_rules
61
+ assert(Regexp.compile(path1) =~ default_path_rules[0])
62
+
63
+ GetText::LocalePath.memoize_clear
64
+ ENV["GETTEXT_PATH"] = "#{path1},#{path2}"
65
+ default_path_rules = GetText::LocalePath.default_path_rules
66
+ assert(Regexp.compile(path1) =~ default_path_rules[0])
67
+ assert(Regexp.compile(path2) =~ default_path_rules[1])
68
+ end
69
+
70
+ def test_default_path_rules
71
+ GetText::LocalePath.memoize_clear
72
+ $LOAD_PATH.unshift("./lib")
73
+ default_path_rules = GetText::LocalePath.default_path_rules
74
+ assert_equal($LOAD_PATH[0], "./lib")
75
+ end
50
76
  end