gettext 1.8.0 → 1.9.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 (180) hide show
  1. data/ChangeLog +120 -0
  2. data/NEWS +16 -0
  3. data/README +27 -19
  4. data/data/locale/ca/LC_MESSAGES/rails.mo +0 -0
  5. data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -0
  6. data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
  7. data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
  8. data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
  9. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  10. data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
  11. data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
  12. data/data/locale/eo/LC_MESSAGES/rails.mo +0 -0
  13. data/data/locale/eo/LC_MESSAGES/rgettext.mo +0 -0
  14. data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
  15. data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
  16. data/data/locale/et/LC_MESSAGES/rails.mo +0 -0
  17. data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
  18. data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
  19. data/data/locale/it/LC_MESSAGES/rails.mo +0 -0
  20. data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
  21. data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
  22. data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
  23. data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
  24. data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
  25. data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
  26. data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
  27. data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
  28. data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
  29. data/data/locale/ru/LC_MESSAGES/rails.mo +0 -0
  30. data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
  31. data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
  32. data/data/locale/zh/LC_MESSAGES/rails.mo +0 -0
  33. data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
  34. data/data/locale/zh_TW/LC_MESSAGES/rails.mo +0 -0
  35. data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
  36. data/lib/gettext.rb +13 -10
  37. data/lib/gettext/active_record.rb +130 -113
  38. data/lib/gettext/erb.rb +2 -2
  39. data/lib/gettext/locale.rb +11 -5
  40. data/lib/gettext/locale_cgi.rb +3 -3
  41. data/lib/gettext/locale_posix.rb +2 -2
  42. data/lib/gettext/locale_win32.rb +2 -1
  43. data/lib/gettext/parser/active_record.rb +24 -14
  44. data/lib/gettext/parser/ruby.rb +4 -63
  45. data/lib/gettext/poparser.rb +3 -3
  46. data/lib/gettext/rails.rb +23 -20
  47. data/lib/gettext/rgettext.rb +6 -6
  48. data/lib/gettext/utils.rb +12 -6
  49. data/lib/gettext/version.rb +2 -2
  50. data/po/ca/rails.po +121 -0
  51. data/po/ca/rgettext.po +130 -0
  52. data/po/cs/rails.po +30 -26
  53. data/po/cs/rgettext.po +44 -36
  54. data/po/de/rails.po +28 -24
  55. data/po/de/rgettext.po +43 -35
  56. data/po/el/rails.po +38 -34
  57. data/po/el/rgettext.po +54 -46
  58. data/po/eo/rails.po +121 -0
  59. data/po/eo/rgettext.po +127 -0
  60. data/po/es/rails.po +28 -24
  61. data/po/es/rgettext.po +45 -37
  62. data/po/et/rails.po +28 -24
  63. data/po/fr/rails.po +39 -33
  64. data/po/fr/rgettext.po +43 -35
  65. data/po/it/rails.po +28 -24
  66. data/po/it/rgettext.po +43 -35
  67. data/po/ja/rails.po +30 -26
  68. data/po/ja/rgettext.po +44 -36
  69. data/po/ko/rails.po +36 -32
  70. data/po/ko/rgettext.po +43 -35
  71. data/po/nl/rails.po +32 -28
  72. data/po/nl/rgettext.po +46 -38
  73. data/po/pt_BR/rails.po +36 -31
  74. data/po/pt_BR/rgettext.po +45 -37
  75. data/po/rails.pot +28 -24
  76. data/po/rgettext.pot +39 -31
  77. data/po/ru/rails.po +36 -30
  78. data/po/ru/rgettext.po +50 -41
  79. data/po/sv/rgettext.po +40 -32
  80. data/po/zh/rails.po +29 -24
  81. data/po/zh/rgettext.po +46 -36
  82. data/po/zh_TW/rails.po +29 -24
  83. data/po/zh_TW/rgettext.po +45 -36
  84. data/samples/cgi/locale/ca/LC_MESSAGES/helloerb1.mo +0 -0
  85. data/samples/cgi/locale/ca/LC_MESSAGES/helloerb2.mo +0 -0
  86. data/samples/cgi/locale/ca/LC_MESSAGES/hellolib.mo +0 -0
  87. data/samples/cgi/locale/ca/LC_MESSAGES/main.mo +0 -0
  88. data/samples/cgi/locale/eo/LC_MESSAGES/helloerb1.mo +0 -0
  89. data/samples/cgi/locale/eo/LC_MESSAGES/helloerb2.mo +0 -0
  90. data/samples/cgi/locale/eo/LC_MESSAGES/hellolib.mo +0 -0
  91. data/samples/cgi/locale/eo/LC_MESSAGES/main.mo +0 -0
  92. data/samples/cgi/po/ca/helloerb1.po +59 -0
  93. data/samples/cgi/po/ca/helloerb2.po +51 -0
  94. data/samples/cgi/po/ca/hellolib.po +23 -0
  95. data/samples/cgi/po/ca/main.po +83 -0
  96. data/samples/cgi/po/eo/helloerb1.po +60 -0
  97. data/samples/cgi/po/eo/helloerb2.po +52 -0
  98. data/samples/cgi/po/eo/hellolib.po +24 -0
  99. data/samples/cgi/po/eo/main.po +84 -0
  100. data/samples/locale/ca/LC_MESSAGES/hello.mo +0 -0
  101. data/samples/locale/ca/LC_MESSAGES/hello2.mo +0 -0
  102. data/samples/locale/ca/LC_MESSAGES/hello_noop.mo +0 -0
  103. data/samples/locale/ca/LC_MESSAGES/hello_plural.mo +0 -0
  104. data/samples/locale/ca/LC_MESSAGES/helloglade2.mo +0 -0
  105. data/samples/locale/ca/LC_MESSAGES/hellogtk.mo +0 -0
  106. data/samples/locale/ca/LC_MESSAGES/hellotk.mo +0 -0
  107. data/samples/locale/eo/LC_MESSAGES/hello.mo +0 -0
  108. data/samples/locale/eo/LC_MESSAGES/hello2.mo +0 -0
  109. data/samples/locale/eo/LC_MESSAGES/hello_noop.mo +0 -0
  110. data/samples/locale/eo/LC_MESSAGES/hello_plural.mo +0 -0
  111. data/samples/locale/eo/LC_MESSAGES/helloglade2.mo +0 -0
  112. data/samples/locale/eo/LC_MESSAGES/hellogtk.mo +0 -0
  113. data/samples/locale/eo/LC_MESSAGES/hellotk.mo +0 -0
  114. data/samples/po/ca/hello.po +23 -0
  115. data/samples/po/ca/hello2.po +31 -0
  116. data/samples/po/ca/hello_noop.po +27 -0
  117. data/samples/po/ca/hello_plural.po +25 -0
  118. data/samples/po/ca/helloglade2.po +31 -0
  119. data/samples/po/ca/hellogtk.po +23 -0
  120. data/samples/po/ca/hellotk.po +23 -0
  121. data/samples/po/eo/hello.po +23 -0
  122. data/samples/po/eo/hello2.po +31 -0
  123. data/samples/po/eo/hello_noop.po +27 -0
  124. data/samples/po/eo/hello_plural.po +26 -0
  125. data/samples/po/eo/helloglade2.po +32 -0
  126. data/samples/po/eo/hellogtk.po +23 -0
  127. data/samples/po/eo/hellotk.po +24 -0
  128. data/samples/rails/app/views/blog/list.rhtml +0 -1
  129. data/samples/rails/config/environment.rb +2 -0
  130. data/samples/rails/db/schema.rb +0 -79
  131. data/samples/rails/lib/tasks/gettext.rake +2 -1
  132. data/samples/rails/locale/ca/LC_MESSAGES/blog.mo +0 -0
  133. data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
  134. data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
  135. data/samples/rails/locale/el/LC_MESSAGES/blog.mo +0 -0
  136. data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
  137. data/samples/rails/locale/eo/LC_MESSAGES/blog.mo +0 -0
  138. data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
  139. data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
  140. data/samples/rails/locale/it/LC_MESSAGES/blog.mo +0 -0
  141. data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
  142. data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
  143. data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
  144. data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
  145. data/samples/rails/locale/ru/LC_MESSAGES/blog.mo +0 -0
  146. data/samples/rails/locale/zh/LC_MESSAGES/blog.mo +0 -0
  147. data/samples/rails/locale/zh_TW/LC_MESSAGES/blog.mo +0 -0
  148. data/samples/rails/po/blog.pot +106 -106
  149. data/samples/rails/po/ca/blog.po +105 -0
  150. data/samples/rails/po/cs/blog.po +107 -110
  151. data/samples/rails/po/de/blog.po +107 -107
  152. data/samples/rails/po/el/blog.po +105 -105
  153. data/samples/rails/po/en/blog.po +107 -107
  154. data/samples/rails/po/eo/blog.po +106 -0
  155. data/samples/rails/po/es/blog.po +105 -105
  156. data/samples/rails/po/fr/blog.po +105 -105
  157. data/samples/rails/po/it/blog.po +105 -105
  158. data/samples/rails/po/ja/blog.po +105 -105
  159. data/samples/rails/po/ko/blog.po +105 -105
  160. data/samples/rails/po/nl/blog.po +105 -105
  161. data/samples/rails/po/pt_BR/blog.po +105 -105
  162. data/samples/rails/po/ru/blog.po +105 -105
  163. data/samples/rails/po/zh/blog.po +105 -105
  164. data/samples/rails/po/zh_TW/blog.po +107 -107
  165. data/samples/rails/vendor/plugins/gettext/locale/ca/LC_MESSAGES/gettext_plugin.mo +0 -0
  166. data/samples/rails/vendor/plugins/gettext/po/ca/gettext_plugin.po +27 -0
  167. data/test/README +6 -0
  168. data/test/Rakefile +1 -1
  169. data/test/fixtures/book.rb +3 -0
  170. data/test/fixtures/user.rb +3 -0
  171. data/test/gettext_test_active_record.rb +347 -67
  172. data/test/gettext_test_cgi.rb +27 -2
  173. data/test/gettext_test_parser.rb +102 -4
  174. data/test/gettext_test_rails.rb +6 -1
  175. data/test/locale/ja/LC_MESSAGES/active_record.mo +0 -0
  176. data/test/po/ja/active_record.po +17 -17
  177. data/test/test.sh +1 -0
  178. data/test/test_rubyparser.rb +6 -4
  179. metadata +889 -795
  180. data/pkg/ruby-gettext-package-1.8.0/ext/gettext/extconf.rb +0 -20
data/ChangeLog CHANGED
@@ -1,3 +1,123 @@
1
+ 2007-01-22 Masao Mutoh <mutoh@highway.ne.jp>
2
+
3
+ * NEWS: Updated.
4
+ * lib/gettext/active_record.rb: Use alias_method_chain not to
5
+ override original methods directly(again). [Feature Requests #7428]
6
+ * test/gettext_test_parser.rb: Add tests for activerecord parser.
7
+ * lib/gettext/rails.rb: Require action_controller instead of activesupport
8
+ for Rails-1.2.1.
9
+ * po/el/*.po: Updated by Vassilis Rizopoulos.
10
+ * po/ja/rails.po: Fixed typos by NANKI Haruo.
11
+
12
+ 2007-01-16 Masao Mutoh <mutoh@highway.ne.jp>
13
+
14
+ * lib/gettext/parser/active_record.rb: Don't duplicate "file:-".
15
+
16
+ 2007-01-14 Masao Mutoh <mutoh@highway.ne.jp>
17
+
18
+ * lib/gettext/active_record.rb: Use alias_method_chain not to
19
+ override original methods directly. [Feature Requests #7428]
20
+ * test/gettext_test_active_record.rb: Update to work Rails-1.2RC2.
21
+
22
+ 2006-12-26 Masao Mutoh <mutoh@highway.ne.jp>
23
+
24
+ * po/zh/*.po, po/zh_TW/*.po: Updated by Yang Bob.
25
+
26
+ 2006-12-22 Masao Mutoh <mutoh@highway.ne.jp>
27
+
28
+ * samples/rails/po/eo/blog.po: Fixed some typos by Malte Milatz.
29
+
30
+ 2006-12-22 Masao Mutoh <mutoh@highway.ne.jp>
31
+
32
+ * **/po/ca/*.po: Added ca(Catalan) locale by Ramon Salvadó.
33
+
34
+ 2006-12-17 Masao Mutoh <mutoh@highway.ne.jp>
35
+
36
+ * po/cs/*.po: Updated by Karel Miarka.
37
+ * **/po/eo/*.po: Added eo(Esperanto) locale by Malte Milatz.
38
+
39
+ 2006-12-15 Masao Mutoh <mutoh@highway.ne.jp>
40
+
41
+ * po/ko/*.po: Updated by Gyoung-Yoon Noh.
42
+
43
+ 2006-12-10 Masao Mutoh <mutoh@highway.ne.jp>
44
+
45
+ * po/de/*.po: Updated by Patrick Lenz.
46
+ * po/nl/*.po: Updated by Menno Jonkers.
47
+ * po/es/*.po: Updated by David Espada.
48
+
49
+ 2006-12-09 Masao Mutoh <mutoh@highway.ne.jp>
50
+
51
+ * po/pt_BR/*.po: Updated by Joao Pedrosa.
52
+ * po/ru/*.po: Updated by Yuri Kozlov.
53
+ * po/ja/*.po: Updated.
54
+
55
+ 2006-12-08 Masao Mutoh <mutoh@highway.ne.jp>
56
+
57
+ * lib/gettext/rgettext.rb: Improve option messages.
58
+
59
+ 2006-12-07 Masao Mutoh <mutoh@highway.ne.jp>
60
+
61
+ * lib/gettext/erb.rb: Removed the dependency to GetText::Container which was
62
+ deprecated.
63
+
64
+ 2006-12-05 Masao Mutoh <mutoh@highway.ne.jp>
65
+
66
+ * lib/gettext/poparser.rb: Added.
67
+
68
+ 2006-12-03 Masao Mutoh <mutoh@highway.ne.jp>
69
+
70
+ * lib/gettext.rb: Changed GetText.locale= to set not only current locale
71
+ to all Textdomains but also default locale.
72
+ * lib/gettext/locale.rb: Locale.set_default accept locale as String.
73
+ * test/gettext_test_active_record.rb: Update to test activerecord-1.14.4.6657.
74
+
75
+ 2006-12-02 Masao Mutoh <mutoh@highway.ne.jp>
76
+
77
+ * lib/gettext/rails.rb: Unit test works on 1.2RC1. Reported by KAKUTANI Shintaro.
78
+ * lib/gettext.rb: Updates default locale when using GetText.set_locale_all
79
+ * po/**/rails.po[t]: Updated.
80
+
81
+ 2006-11-27 Masao Mutoh <mutoh@highway.ne.jp>
82
+
83
+ * lib/gettext/rails.rb: Fix the deprecated accessing to instance variables
84
+ directly for rails 1.2RC1.
85
+
86
+ 2006-11-06 Masao Mutoh <mutoh@highway.ne.jp>
87
+
88
+ * lib/gettext/utils.rb: Skip to create new po-files.
89
+ It avoids the po-files become empty when GNU msgmerge was failed.
90
+ By Fabian Kreutz.
91
+
92
+ 2006-10-21 Masao Mutoh <mutoh@highway.ne.jp>
93
+
94
+ * po/fr/rails.po: Improved by David Sulc.
95
+
96
+ 2006-10-15 Masao Mutoh <mutoh@highway.ne.jp>
97
+
98
+ * lib/gettext/parser/active_record.rb: Work updatepo task with rails_edge.
99
+
100
+ 2006-10-08 Masao Mutoh <mutoh@highway.ne.jp>
101
+
102
+ * lib/gettext/parser/active_record.rb: Fixed an error using hbtm.
103
+ Reported by Mihnea Capraru.
104
+
105
+ 2006-10-04 Masao Mutoh <mutoh@highway.ne.jp>
106
+
107
+ * README, lib/gettext/rgettext.rb: Changed the author e-mail address.
108
+
109
+ 2006-09-24 Masao Mutoh <mutoh@highway.ne.jp>
110
+
111
+ * lib/gettext/active_record.rb: Re-fix to work rails_edge again.
112
+ Reported by Isak Hansen.
113
+ * po/pt_BR/rails.po: Updated by Antonio S. de A. Terceiro.
114
+
115
+ 2006-09-21 Masao Mutoh <mutoh@highway.ne.jp>
116
+
117
+ * lib/gettext/rails.rb: Fixed a bug init_gettext can't accept
118
+ any options correctly and locale_path was set wrong value.
119
+ Reported by pedro palazon.
120
+
1
121
  2006-09-12 Masao Mutoh <mutoh@highway.ne.jp>
2
122
 
3
123
  * lib/gettext/textdomain.rb: Fixed a bug of add_default_locale_path.
data/NEWS CHANGED
@@ -1,3 +1,19 @@
1
+ = Ruby-GetText-Package-1.9.0 (2007-01-22)
2
+
3
+ * Support Catalan(ca), Esperanto(eo)
4
+ * Update translations: zh_CN, zh_TW, cs, nl, en, de, el, es, ja, ko, pt_BR, ru.
5
+ * Support Ruby on Rails-1.2.1.
6
+ * Code cleanupand improved. Fixed bugs.
7
+
8
+ Thanks to:
9
+ Translators:
10
+ Antonio S. de A. Terceiro, David Espada, David Sulc, Gyoung-Yoon Noh,
11
+ Joao Pedrosa, Malte Milatz, Menno Jonkers, Patrick Lenz, Yang Bob,
12
+ Yuri Kozlov, Vassilis Rizopoulos
13
+
14
+ Bug reports, suggestions and patches:
15
+ Fabian Kreutz, KAKUTANI Shintaro, Mihnea Capraru, NANKI Haruo, pedro palazon
16
+
1
17
  = Ruby-GetText-Package-1.8.0 (2006-09-11)
2
18
 
3
19
  * Support Chinese(Taiwan: zh_TW), Estonian(et: rails.po only)
data/README CHANGED
@@ -107,7 +107,7 @@ License
107
107
 
108
108
  * rgettext
109
109
  Copyright (C) 2001-2006 Masao Mutoh <mutoh at highwhay.ne.jp>
110
- Copyright (C) 2001,2002 Yasushi Shoji <yashi at yashi.com>
110
+ Copyright (C) 2001,2002 Yasushi Shoji <yashi at atmark-techno.com>
111
111
 
112
112
  * setup.rb
113
113
  Copyright (C) 2000-2005 Minero Aoki <aamine at loveruby.net>
@@ -119,22 +119,28 @@ License
119
119
 
120
120
  Translators
121
121
  -----------
122
- Chinese(Simplified)(zh_CN) - Yingfeng <blogyingfeng at gmail.com>
123
- Chinese(Traditional)(zh_TW)- LIN CHUNG-YI <xmarsh at gmail.com>
122
+ Catalan(ca) - Ramon Salvadó <rsalvado at gnuine.com>
123
+ Chinese(Simplified)(zh_CN) - Yang Bob <bob.yang.dev at gmail.com> (current)
124
+ Yingfeng <blogyingfeng at gmail.com>
125
+ Chinese(Traditional)(zh_TW)- Yang Bob <bob.yang.dev at gmail.com> (current)
126
+ LIN CHUNG-YI <xmarsh at gmail.com>
124
127
  Czech(cs) - Karel Miarka <kajism at yahoo.com>
125
128
  Dutch(nl) - Menno Jonkers <ruby-gettext at jonkers.com>
129
+ Esperanto(eo) - Malte Milatz <malte at gmx-topmail.de>
126
130
  Estonian(et) - Erkki Eilonen <erkki at itech.ee>
127
- French(fr) - Laurent Sansonetti <laurent.sansonetti at gmail.com>
131
+ French(fr) - Laurent Sansonetti <laurent.sansonetti at gmail.com> (current)
132
+ David Sulc <davidsulc at gmail.com>
128
133
  German(de) - Patrick Lenz <patrick at limited-overload.de> (current)
129
134
  Detlef Reichl <detlef.reichl at gmx.org>
130
135
  Sven Herzberg <herzi at abi02.de>
131
136
  Sascha Ebach <se at digitale-wertschoepfung.de>
132
- Greek(el) - Damphyr <damphyr at gmx.net>
137
+ Greek(el) - Vassilis Rizopoulos <damphyr at gmx.net>
133
138
  Italian(it) - Marco Lazzeri <marco.lazzeri at gmail.com>
134
139
  Gabriele Renzi <surrender_it at yahoo.it>
135
140
  Japanese(ja) - Masao Mutoh <mutoh at highway.ne.jp>
136
141
  Korean(ko) - Gyoung-Yoon Noh <nohmad at gmail.com>
137
- Portuguese(Brazil)(pt_BR) - Joao Pedrosa <joaopedrosa at gmail.com>
142
+ Portuguese(Brazil)(pt_BR) - Antonio S. de A. Terceiro <terceiro at softwarelivre.org>
143
+ Joao Pedrosa <joaopedrosa at gmail.com> (current)
138
144
  Russian(ru) - Yuri Kozlov <kozlov.y at gmail.com>
139
145
  Spanish(es) - David Espada <davinci at escomposlinux.org> (current)
140
146
  David Moreno Garza <damog at damog.net>
@@ -142,21 +148,23 @@ Swedish(sv) - Nikolai Weibull <mailing-lists.ruby-talk at rawuncu
142
148
 
143
149
  Status of translations
144
150
  ----------------------
145
- Chinese(zh_CN) - 1.8.0
146
- Chinese(zh_TW) - 1.8.0
147
- Czech(cs) - 1.8.0
148
- Dutch(nl) - 1.8.0
149
- English(default) - 1.8.0
151
+ Catalan(ca) - 1.9.0 (new)
152
+ Chinese(zh_CN) - 1.9.0
153
+ Chinese(zh_TW) - 1.9.0
154
+ Czech(cs) - 1.9.0
155
+ Dutch(nl) - 1.9.0
156
+ English(default) - 1.9.0
157
+ Esperanto(eo) - 1.9.0 (new)
150
158
  Estonian(et) - 1.8.0 (rails.po only)
151
- French(fr) - 1.8.0
152
- German(de) - 1.8.0
153
- Greek(el) - 1.6.0 (old)
154
- Spanish(es) - 1.8.0
159
+ French(fr) - 1.8.0 (old)
160
+ German(de) - 1.9.0
161
+ Greek(el) - 1.9.0
162
+ Spanish(es) - 1.9.0
155
163
  Italian(it) - 1.6.0 (old)
156
- Japanese(ja) - 1.8.0
157
- Korean(ko) - 1.8.0
158
- Portuguese(Brazil)(pt_BR) - 1.8.0
159
- Russian(ru) - 1.8.0
164
+ Japanese(ja) - 1.9.0
165
+ Korean(ko) - 1.9.0
166
+ Portuguese(Brazil)(pt_BR) - 1.9.0
167
+ Russian(ru) - 1.9.0
160
168
  Swedish(sv) - 0.8.0 (old)
161
169
 
162
170
  Maintainer
@@ -10,7 +10,7 @@
10
10
  You may redistribute it and/or modify it under the same
11
11
  license terms as Ruby.
12
12
 
13
- $Id: gettext.rb,v 1.20 2006/09/10 15:08:32 mutoh Exp $
13
+ $Id: gettext.rb,v 1.22 2006/12/03 16:26:59 mutoh Exp $
14
14
  =end
15
15
 
16
16
  require 'rbconfig'
@@ -241,7 +241,7 @@ module GetText
241
241
  msg
242
242
  end
243
243
 
244
- # Sets the default locale to the current class/module
244
+ # Sets the current locale to the current class/module
245
245
  #
246
246
  # Notice that you shouldn't use this for your own Libraries.
247
247
  # * locale: a locale string or Locale::Object.
@@ -276,9 +276,9 @@ module GetText
276
276
  self
277
277
  end
278
278
 
279
- # Sets locale to the all textdomains.
279
+ # Sets current locale to the all textdomains.
280
280
  #
281
- # Notice that you shouldn't use this for your own Libraries.
281
+ # Note that you shouldn't use this for your own Libraries.
282
282
  # * locale: a locale string or Locale::Object, otherwise nil to use default locale.
283
283
  # * Returns: self
284
284
  def set_locale_all(locale)
@@ -289,24 +289,27 @@ module GetText
289
289
  else
290
290
  ret = Locale::Object.new(locale.to_s)
291
291
  end
292
- Locale.set_current(ret)
293
292
  else
294
- Locale.set_current(nil)
295
- ret = Locale.get
293
+ ret = Locale.default
296
294
  end
297
295
  ret.charset = output_charset if output_charset
296
+ Locale.set_current(ret)
298
297
  TextDomainManager.each_all {|textdomain|
299
298
  textdomain.set_locale(ret)
300
299
  }
301
300
  self
302
301
  end
303
302
 
304
- # Same as GetText.set_locale_all.
305
- # * locale: a locale string
303
+ # Sets the default/current locale. This method haves the strongest infulence.
304
+ # All of the Textdomains are set the new locale.
305
+ #
306
+ # Note that you shouldn't use this for your own Libraries.
307
+ # * locale: a locale string or Locale::Object
306
308
  # * Returns: a locale string
307
309
  def locale=(locale)
310
+ Locale.default = locale
308
311
  set_locale_all(locale)
309
- locale
312
+ Locale.default
310
313
  end
311
314
 
312
315
  # Sets charset(String) such as "euc-jp", "sjis", "CP932", "utf-8", ...
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  gettext/active_record.rb - GetText for ActiveRecord
3
3
 
4
- Copyright (C) 2006 Masao Mutoh
4
+ Copyright (C) 2006,2007 Masao Mutoh
5
5
 
6
6
  You may redistribute it and/or modify it under the same
7
7
  license terms as Ruby.
8
8
 
9
- $Id: active_record.rb,v 1.9 2006/09/10 15:08:32 mutoh Exp $
9
+ $Id: active_record.rb,v 1.14 2007/01/21 15:16:06 mutoh Exp $
10
10
  =end
11
11
  require 'gettext'
12
12
  require 'active_record'
@@ -16,6 +16,19 @@ module ActiveRecord #:nodoc:
16
16
  extend GetText
17
17
  include GetText
18
18
  end
19
+
20
+ class RecordInvalid < ActiveRecordError #:nodoc:
21
+ attr_reader :record
22
+ include GetText
23
+ bindtextdomain("rails")
24
+
25
+ def initialize(record)
26
+ @record = record
27
+ super(_("Validation failed: %{error_messages}") %
28
+ {:error_messages => @record.errors.full_messages.join(", ")})
29
+ end
30
+ end
31
+
19
32
 
20
33
  module ConnectionAdapters #:nodoc:
21
34
  # An abstract definition of a column in a table.
@@ -46,12 +59,13 @@ module ActiveRecord #:nodoc:
46
59
  end
47
60
  }
48
61
  end
49
- if ActiveRecord::VERSION::STRING >= "1.14.5"
62
+ if respond_to? :included
50
63
  def self.included(base) # :nodoc:
51
64
  super
52
65
  real_included(base)
53
66
  end
54
67
  else
68
+ # Since rails-1.2.0.
55
69
  def self.append_features(base) # :nodoc:
56
70
  super
57
71
  real_included(base)
@@ -61,7 +75,7 @@ end
61
75
  module ClassMethods #:nodoc:
62
76
  @@custom_error_messages_d = {}
63
77
  # Very ugly but...
64
- def validates_length_of(*attrs) #:nodoc:
78
+ def validates_length_of_with_gettext(*attrs) #:nodoc:
65
79
  if attrs.last.is_a?(Hash)
66
80
  msg = attrs.last[:message] || attrs.last[:too_long] || attrs.last[:too_short] || attrs.last[:wrong_length]
67
81
  if msg
@@ -70,6 +84,8 @@ end
70
84
  end
71
85
  validates_size_of(*attrs)
72
86
  end
87
+ alias_method_chain :validates_length_of, :gettext
88
+
73
89
  def custom_error_messages_d #:nodoc:
74
90
  @@custom_error_messages_d
75
91
  end
@@ -86,88 +102,90 @@ end
86
102
  @@gettext_untranslate = Hash.new(false)
87
103
  @@gettext_untranslate_columns = {}
88
104
 
89
- # Untranslate all of the tablename/fieldnames in this model class.
90
- def self.untranslate_all
91
- @@gettext_untranslate[self] = true
92
- end
93
-
94
- # Returns true if "untranslate_all" is called. Otherwise false.
95
- def self.untranslate_all?
96
- @@gettext_untranslate[self]
97
- end
98
-
99
- # Sets the untranslate columns.
100
- # (e.g.) untranslate :foo, :bar, :baz
101
- def self.untranslate(*w)
102
- ary = @@gettext_untranslate_columns[self] || []
103
- ary += w.collect{|v| v.to_s}
104
- @@gettext_untranslate_columns[self] = ary
105
- end
105
+ class << self
106
+ # Untranslate all of the tablename/fieldnames in this model class.
107
+ def untranslate_all
108
+ @@gettext_untranslate[self] = true
109
+ end
106
110
 
107
- # Returns true if the column is set "untranslate".
108
- # (e.g.) untranslate? :foo
109
- def self.untranslate?(columnname)
110
- ary = @@gettext_untranslate_columns[self] || []
111
- ary.include?(columnname)
112
- end
111
+ # Returns true if "untranslate_all" is called. Otherwise false.
112
+ def untranslate_all?
113
+ @@gettext_untranslate[self]
114
+ end
113
115
 
114
- def self.untranslate_data #:nodoc:
115
- [@@gettext_untranslate[self], @@gettext_untranslate_columns[self] || []]
116
- end
116
+ # Sets the untranslate columns.
117
+ # (e.g.) untranslate :foo, :bar, :baz
118
+ def untranslate(*w)
119
+ ary = @@gettext_untranslate_columns[self] || []
120
+ ary += w.collect{|v| v.to_s}
121
+ @@gettext_untranslate_columns[self] = ary
122
+ end
123
+
124
+ # Returns true if the column is set "untranslate".
125
+ # (e.g.) untranslate? :foo
126
+ def untranslate?(columnname)
127
+ ary = @@gettext_untranslate_columns[self] || []
128
+ ary.include?(columnname)
129
+ end
117
130
 
118
- def self.columns
119
- unless defined? @columns
120
- @columns = nil
131
+ def untranslate_data #:nodoc:
132
+ [@@gettext_untranslate[self], @@gettext_untranslate_columns[self] || []]
121
133
  end
122
- unless @columns
123
- @columns = connection.columns(table_name, "#{name} Columns")
124
- @columns.each {|column|
125
- column.table_class = self
126
- column.primary = column.name == primary_key
127
- }
134
+
135
+ def columns_with_gettext
136
+ unless defined? @columns
137
+ @columns = nil
138
+ end
139
+ unless @columns
140
+ @columns = connection.columns(table_name, "#{name} Columns")
141
+ @columns.each {|column|
142
+ column.table_class = self
143
+ column.primary = column.name == primary_key
144
+ }
145
+ end
146
+ @columns
128
147
  end
129
- @columns
130
- end
148
+ alias_method_chain :columns, :gettext
131
149
 
132
- # call-seq:
133
- # set_error_message_title(msg)
134
- #
135
- # ((*Deprecated*))
136
- # Use ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_title
137
- # instead.
138
- #
139
- # Sets a your own title of error message dialog.
140
- # * msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
141
- # * Returns: [single_msg, plural_msg]
142
- def self.set_error_message_title(msg, plural_msg = nil)
143
- ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_title(msg, plural_msg)
144
- end
145
-
146
- # call-seq:
147
- # set_error_message_explanation(msg)
148
- #
149
- # ((*Deprecated*))
150
- # Use ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_explanation
151
- # instead.
152
- #
153
- # Sets a your own explanation of the error message dialog.
154
- # * msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
155
- # * Returns: [single_msg, plural_msg]
156
- def self.set_error_message_explanation(msg, plural_msg = nil)
157
- ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_explanation(msg, plural_msg)
150
+ # call-seq:
151
+ # set_error_message_title(msg)
152
+ #
153
+ # ((*Deprecated*))
154
+ # Use ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_title
155
+ # instead.
156
+ #
157
+ # Sets a your own title of error message dialog.
158
+ # * msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
159
+ # * Returns: [single_msg, plural_msg]
160
+ def set_error_message_title(msg, plural_msg = nil)
161
+ ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_title(msg, plural_msg)
162
+ end
163
+
164
+ # call-seq:
165
+ # set_error_message_explanation(msg)
166
+ #
167
+ # ((*Deprecated*))
168
+ # Use ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_explanation
169
+ # instead.
170
+ #
171
+ # Sets a your own explanation of the error message dialog.
172
+ # * msg: [single_msg, plural_msg]. Usually you need to call this with Nn_().
173
+ # * Returns: [single_msg, plural_msg]
174
+ def set_error_message_explanation(msg, plural_msg = nil)
175
+ ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_explanation(msg, plural_msg)
176
+ end
158
177
  end
159
178
  end
160
-
179
+
161
180
  # activerecord-1.14.3/lib/active_record/validations.rb
162
181
  class Errors #:nodoc:
163
182
  include GetText
164
- alias initialize_without_locale initialize #:nodoc:
165
- alias full_messages_without_localized full_messages #:nodoc:
166
183
 
167
- def initialize(base) # :nodoc:
168
- initialize_without_locale(base)
184
+ def initialize_with_gettext(base) # :nodoc:
185
+ initialize_without_gettext(base)
169
186
  bindtextdomain("rails")
170
187
  end
188
+ alias_method_chain :initialize, :gettext
171
189
 
172
190
  def @@default_error_messages.[]=(id, msg) #:nodoc:
173
191
  @@default_error_messages.update({id => msg})
@@ -198,40 +216,42 @@ end
198
216
  }
199
217
  cattr_accessor :default_error_messages_d
200
218
 
219
+ def localize_error_message(attr, msg, append_field) # :nodoc:
220
+ custom_msg = nil
221
+ #Ugly but... :-<
222
+ @@default_error_messages_d.dup.merge(@base.custom_error_messages_d).each do |key, regexp|
223
+ if regexp =~ msg
224
+ custom_msg = @base.gettext(key)
225
+ custom_msg = _(msg) if custom_msg == msg
226
+ custom_msg = _(custom_msg) % $1.to_i
227
+ break
228
+ end
229
+ end
230
+
231
+ unless custom_msg
232
+ custom_msg = @base.gettext(msg)
233
+ custom_msg = _(msg) if custom_msg == msg
234
+ end
235
+ if attr == "base"
236
+ full_message = custom_msg
237
+ elsif /%\{fn\}/ =~ custom_msg
238
+ full_message = custom_msg % {:fn => @base.class.human_attribute_name(attr)}
239
+ elsif append_field
240
+ full_message = @base.class.human_attribute_name(attr) + " " + custom_msg
241
+ else
242
+ full_message = custom_msg
243
+ end
244
+ full_message
245
+ end
246
+
201
247
  def localize_error_messages(append_field = true) # :nodoc:
202
248
  # e.g.) foo field: "%{fn} foo" => "Foo foo", "foo" => "Foo foo".
203
249
  errors = {}
204
- @errors.each_key do |attr|
205
- @errors[attr].each do |msg|
206
- next if msg.nil?
207
- custom_msg = nil
208
- #Ugly but... :-<
209
- @@default_error_messages_d.dup.merge(@base.custom_error_messages_d).each do |key, regexp|
210
- if regexp =~ msg
211
- custom_msg = @base.gettext(key)
212
- custom_msg = _(msg) if custom_msg == msg
213
- custom_msg = _(custom_msg) % $1.to_i
214
- break
215
- end
216
- end
217
-
218
- unless custom_msg
219
- custom_msg = @base.gettext(msg)
220
- custom_msg = _(msg) if custom_msg == msg
221
- end
222
- if attr == "base"
223
- full_message = custom_msg
224
- elsif /%\{fn\}/ =~ custom_msg
225
- full_message = custom_msg % {:fn => @base.class.human_attribute_name(attr)}
226
- elsif append_field
227
- full_message = @base.class.human_attribute_name(attr) + " " + custom_msg
228
- else
229
- full_message = custom_msg
230
- end
231
- errors[attr] ||= []
232
- errors[attr] << full_message
233
- end
234
- end
250
+ each {|attr, msg|
251
+ next if msg.nil?
252
+ errors[attr] ||= []
253
+ errors[attr] << localize_error_message(attr, msg, append_field)
254
+ }
235
255
  errors
236
256
  end
237
257
 
@@ -243,23 +263,19 @@ end
243
263
  # * If the error messages include %{fn}, it returns formatted text such as "foo %{fn}" => "foo Field"
244
264
  # * else, the error messages are prepended the field name such as "foo" => "foo" (Same as default behavior).
245
265
  # Note that this behaviour is different from full_messages.
246
- def on(attribute)
266
+ def on_with_gettext(attribute)
247
267
  # e.g.) foo field: "%{fn} foo" => "Foo foo", "foo" => "foo".
248
- errors = localize_error_messages(false)
249
- if errors[attribute.to_s].nil?
250
- nil
251
- elsif errors[attribute.to_s].length == 1
252
- errors[attribute.to_s].first
253
- else
254
- errors[attribute.to_s]
255
- end
268
+ errors = localize_error_messages(false)[attribute.to_s]
269
+ return nil if errors.nil?
270
+ errors.size == 1 ? errors.first : errors
256
271
  end
272
+ alias_method_chain :on, :gettext
257
273
 
258
274
  # Returns all the full error messages in an array.
259
275
  # * If the error messages include %{fn}, it returns formatted text such as "foo %{fn}" => "foo Field"
260
276
  # * else, the error messages are prepended the field name such as "foo" => "Field foo" (Same as default behavior).
261
277
  # As L10n, first one is recommanded because the order of subject,verb and others are not same in languages.
262
- def full_messages
278
+ def full_messages_with_gettext
263
279
  full_messages = []
264
280
  errors = localize_error_messages
265
281
  errors.each_key do |attr|
@@ -270,6 +286,7 @@ end
270
286
  end
271
287
  full_messages
272
288
  end
289
+ alias_method_chain :full_messages, :gettext
273
290
  end
274
291
  end
275
292