gettext 1.7.0-mswin32 → 1.8.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/ChangeLog +139 -0
  2. data/NEWS +31 -0
  3. data/README +31 -15
  4. data/Rakefile +3 -2
  5. data/bin/rgettext +1 -1
  6. data/bin/rmsgfmt +1 -1
  7. data/bin/rmsgmerge +1 -1
  8. data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
  9. data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
  10. data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
  11. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  12. data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
  13. data/data/locale/el/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 +50 -23
  37. data/lib/gettext/active_record.rb +275 -0
  38. data/lib/gettext/locale.rb +9 -2
  39. data/lib/gettext/locale_cgi.rb +5 -4
  40. data/lib/gettext/locale_object.rb +5 -4
  41. data/lib/gettext/parser/{activerecord.rb → active_record.rb} +31 -14
  42. data/lib/gettext/parser/ruby.rb +48 -44
  43. data/lib/gettext/rails.rb +111 -253
  44. data/lib/gettext/rgettext.rb +34 -6
  45. data/lib/gettext/string.rb +3 -2
  46. data/lib/gettext/textdomain.rb +3 -3
  47. data/lib/gettext/version.rb +1 -1
  48. data/po/cs/rails.po +61 -61
  49. data/po/cs/rgettext.po +37 -55
  50. data/po/de/rails.po +73 -72
  51. data/po/de/rgettext.po +39 -56
  52. data/po/el/rails.po +60 -60
  53. data/po/el/rgettext.po +26 -44
  54. data/po/es/rails.po +60 -60
  55. data/po/es/rgettext.po +28 -52
  56. data/po/et/rails.po +118 -0
  57. data/po/fr/rails.po +60 -60
  58. data/po/fr/rgettext.po +26 -46
  59. data/po/it/rails.po +68 -68
  60. data/po/it/rgettext.po +35 -53
  61. data/po/ja/rails.po +62 -61
  62. data/po/ja/rgettext.po +27 -45
  63. data/po/ko/rails.po +61 -60
  64. data/po/ko/rgettext.po +34 -54
  65. data/po/nl/rails.po +59 -60
  66. data/po/nl/rgettext.po +35 -55
  67. data/po/pt_BR/rails.po +74 -73
  68. data/po/pt_BR/rgettext.po +36 -52
  69. data/po/rails.pot +61 -61
  70. data/po/rgettext.pot +25 -43
  71. data/po/ru/rails.po +61 -62
  72. data/po/ru/rgettext.po +26 -51
  73. data/po/sv/rgettext.po +27 -44
  74. data/po/zh/rails.po +62 -60
  75. data/po/zh/rgettext.po +28 -47
  76. data/po/zh_TW/rails.po +114 -0
  77. data/po/zh_TW/rgettext.po +121 -0
  78. data/samples/cgi/locale/zh_TW/LC_MESSAGES/helloerb1.mo +0 -0
  79. data/samples/cgi/locale/zh_TW/LC_MESSAGES/helloerb2.mo +0 -0
  80. data/samples/cgi/locale/zh_TW/LC_MESSAGES/hellolib.mo +0 -0
  81. data/samples/cgi/locale/zh_TW/LC_MESSAGES/main.mo +0 -0
  82. data/samples/cgi/po/zh_TW/helloerb1.po +67 -0
  83. data/samples/cgi/po/zh_TW/helloerb2.po +54 -0
  84. data/samples/cgi/po/zh_TW/hellolib.po +26 -0
  85. data/samples/cgi/po/zh_TW/main.po +79 -0
  86. data/samples/locale/zh_TW/LC_MESSAGES/hello.mo +0 -0
  87. data/samples/locale/zh_TW/LC_MESSAGES/hello2.mo +0 -0
  88. data/samples/locale/zh_TW/LC_MESSAGES/hello_noop.mo +0 -0
  89. data/samples/locale/zh_TW/LC_MESSAGES/hello_plural.mo +0 -0
  90. data/samples/locale/zh_TW/LC_MESSAGES/helloglade2.mo +0 -0
  91. data/samples/locale/zh_TW/LC_MESSAGES/hellogtk.mo +0 -0
  92. data/samples/locale/zh_TW/LC_MESSAGES/hellotk.mo +0 -0
  93. data/samples/po/hellogtk.pot +1 -1
  94. data/samples/po/zh_TW/hello.po +26 -0
  95. data/samples/po/zh_TW/hello2.po +34 -0
  96. data/samples/po/zh_TW/hello_noop.po +30 -0
  97. data/samples/po/zh_TW/hello_plural.po +28 -0
  98. data/samples/po/zh_TW/helloglade2.po +40 -0
  99. data/samples/po/zh_TW/hellogtk.po +25 -0
  100. data/samples/po/zh_TW/hellotk.po +26 -0
  101. data/samples/rails/README +8 -11
  102. data/samples/rails/app/controllers/application.rb +6 -9
  103. data/samples/rails/app/views/layouts/blog.rhtml +1 -1
  104. data/samples/rails/config/database.yml +1 -1
  105. data/samples/rails/config/environment.rb +1 -0
  106. data/samples/rails/db/schema.rb +90 -0
  107. data/samples/rails/lib/tasks/gettext.rake +1 -1
  108. data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
  109. data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
  110. data/samples/rails/locale/el/LC_MESSAGES/blog.mo +0 -0
  111. data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
  112. data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
  113. data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
  114. data/samples/rails/locale/it/LC_MESSAGES/blog.mo +0 -0
  115. data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
  116. data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
  117. data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
  118. data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
  119. data/samples/rails/locale/ru/LC_MESSAGES/blog.mo +0 -0
  120. data/samples/rails/locale/zh/LC_MESSAGES/blog.mo +0 -0
  121. data/samples/rails/locale/zh_TW/LC_MESSAGES/blog.mo +0 -0
  122. data/samples/rails/po/blog.pot +106 -110
  123. data/samples/rails/po/cs/blog.po +110 -115
  124. data/samples/rails/po/de/blog.po +107 -112
  125. data/samples/rails/po/el/blog.po +105 -109
  126. data/samples/rails/po/en/blog.po +107 -111
  127. data/samples/rails/po/es/blog.po +105 -110
  128. data/samples/rails/po/fr/blog.po +105 -109
  129. data/samples/rails/po/it/blog.po +105 -109
  130. data/samples/rails/po/ja/blog.po +105 -109
  131. data/samples/rails/po/ko/blog.po +105 -109
  132. data/samples/rails/po/nl/blog.po +105 -110
  133. data/samples/rails/po/pt_BR/blog.po +105 -109
  134. data/samples/rails/po/ru/blog.po +105 -107
  135. data/samples/rails/po/zh/blog.po +105 -109
  136. data/samples/rails/po/zh_TW/blog.po +107 -0
  137. data/samples/rails/vendor/plugins/gettext/locale/zh_TW/LC_MESSAGES/gettext_plugin.mo +0 -0
  138. data/samples/rails/vendor/plugins/gettext/po/zh_TW/gettext_plugin.po +30 -0
  139. data/test/Rakefile +44 -0
  140. data/test/fixtures/developer.rb +5 -0
  141. data/test/fixtures/developers.yml +21 -0
  142. data/test/fixtures/reply.rb +40 -0
  143. data/test/fixtures/topic.rb +23 -0
  144. data/test/fixtures/topics.yml +22 -0
  145. data/test/gettext_test.rb +2 -2
  146. data/test/gettext_test_active_record.rb +1479 -0
  147. data/test/gettext_test_rails.rb +2 -0
  148. data/test/locale/ja/LC_MESSAGES/active_record.mo +0 -0
  149. data/test/po/active_record.pot +295 -0
  150. data/test/po/ja/active_record.po +294 -0
  151. data/test/test.sh +1 -0
  152. data/test/test_rubyparser.rb +10 -2
  153. metadata +66 -6
  154. data/samples/rails/db/mysql.sql +0 -8
  155. data/samples/rails/db/postgresql.sql +0 -7
data/ChangeLog CHANGED
@@ -1,3 +1,142 @@
1
+ 2006-09-12 Masao Mutoh <mutoh@highway.ne.jp>
2
+
3
+ * lib/gettext/textdomain.rb: Fixed a bug of add_default_locale_path.
4
+ * lib/gettext/parser/ruby.rb: Improve to output error messages.
5
+
6
+ 2006-09-11 Masao Mutoh <mutoh@highway.ne.jp>
7
+
8
+ * lib/gettext/active_record.rb: Works rails_edge again.
9
+ Reported by Donald Piret. (http://dev.rubyonrails.org/ticket/5810)
10
+
11
+ 2006-09-07 Masao Mutoh <mutoh@highway.ne.jp>
12
+
13
+ * lib/gettext/locale_cgi.rb, locale_object.rb: Speed up.
14
+ * lib/gettext.rb: Fixed to extract correct textdomains in each_textdomain.
15
+
16
+ 2006-09-05 Masao Mutoh <mutoh@highway.ne.jp>
17
+
18
+ * README, NEWS: Updated.
19
+
20
+ 2006-09-04 Masao Mutoh <mutoh@highway.ne.jp>
21
+
22
+ * lib/gettext/rgettext.rb: Raise error when parsing was failed.
23
+ * lib/gettext.rb: GetText.locale= is the alias of GetText.set_locale_all instead
24
+ of GetText.set_locale.
25
+ * test/gettext_test_active_record.rb: Added tests.
26
+ * test/fixtures/*.rb: updated.
27
+ * test/po/active_record.pot, test/po/ja/active_record.po: updated.
28
+
29
+ 2006-09-01 Masao Mutoh <mutoh@highway.ne.jp>
30
+
31
+ * test/gettext_test_active_record.rb: Added tests.
32
+
33
+ 2006-08-31 Masao Mutoh <mutoh@highway.ne.jp>
34
+
35
+ * lib/gettext/active_record.rb: Fix the custom messages of validates_length_of
36
+ with :too_long, :too_short, :wrong_length.
37
+
38
+ 2006-08-30 Masao Mutoh <mutoh@highway.ne.jp>
39
+
40
+ * test/Rakefile, test/db/*sql: Added.
41
+
42
+ 2006-08-29 Masao Mutoh <mutoh@highway.ne.jp>
43
+
44
+ * test/gettext_test_active_record.rb, test/fixtures/*, test/po/active_record.pot,
45
+ test/po/ja/active_record.po: Added tests for ActiveRecord with GetText.
46
+ * lib/gettext/active_record.rb: Messages updated.
47
+ * po/*/rails.po[t]: ditto.
48
+
49
+ 2006-08-22 Masao Mutoh <mutoh@highway.ne.jp>
50
+
51
+ * samples/rails/db/schema.rb: Added.
52
+ * samples/rails/db/*.sql: Removed. Use rake db:schema:load instead.
53
+ * samples/rails/README: Follow above changes.
54
+ * samples/rails/po/*: Updated.
55
+ * lib/gettext/active_record.rb: Fixed the problem of untranslate(_all).
56
+ Reported by Tsutomu Kuroda.
57
+
58
+ 2006-08-21 Masao Mutoh <mutoh@highway.ne.jp>
59
+
60
+ * README: Updated.
61
+ * **/po/zh_TW/*.po: Added zh_TW locale by LIN CHUNG-YI.
62
+
63
+ 2006-08-18 Masao Mutoh <mutoh@highway.ne.jp>
64
+
65
+ * lib/gettext/version.rb: Increment minor version.
66
+ * po/et/rails.po: Added Estonian by Erkki Eilonen.
67
+ * README: ditto.
68
+ * lib/gettext/rails.rb: Add ActionController::Base.(before|after)_init_gettext.
69
+
70
+ 2006-08-15 Masao Mutoh <mutoh@highway.ne.jp>
71
+
72
+ * po/de/rails.po, rgettext.po: Updated by Partick Lenz.
73
+
74
+ 2006-08-13 Masao Mutoh <mutoh@highway.ne.jp>
75
+
76
+ * lib/gettext/locale.rb: Add Locale.system_module.
77
+ * lib/gettext/rails.rb: Remove ActionController::Base.textdomainname
78
+ * lib/gettext.rb, lib/gettext/rails.rb, locale_cgi.rb,
79
+ locale_object.rb, string.rb:
80
+ Speed up. Improve CPU usages.
81
+
82
+ 2006-08-10 Masao Mutoh <mutoh@highway.ne.jp>
83
+
84
+ * lib/gettext/parser/active_record.rb: Improved to find ActiveRecord class
85
+ by steve dp.
86
+
87
+ 2006-08-09 Masao Mutoh <mutoh@highway.ne.jp>
88
+
89
+ * lib/gettext/rails.rb: Code clean up.
90
+ * lib/gettext.rb: Code clean up.
91
+ * lib/gettext/active_record.rb: Removed to call bindtextdomain in Validations.
92
+ It's called in bindtextdomain of init_gettext.
93
+ * lib/gettext/parser/active_record.rb: Rename from activerecord.rb.
94
+
95
+ 2006-08-08 Masao Mutoh <mutoh@highway.ne.jp>
96
+
97
+ * lib/gettext/active_record.rb: Fixed on, error_messages_for.
98
+ by Andreas Neuhaus.
99
+
100
+ 2006-08-04 Masao Mutoh <mutoh@highway.ne.jp>
101
+
102
+ * lib/gettext/rails.rb: Move bindtextdomain_to to lib/gettext.rb.
103
+ New overrideable callback methods (before|after)_init_gettext(cgi).
104
+ These methods is called on the each WWW request.
105
+ * lib/gettext.rb: Add bindtextdomain_to, textdomain_to.
106
+ * samples/rails/app/controllers/application.rb: Add a sample of
107
+ (before|after)_init_gettext(cgi).
108
+
109
+ 2006-07-29 Masao Mutoh <mutoh@highway.ne.jp>
110
+
111
+ * lib/gettext/rgettext.rb: Added -r, -d options.
112
+ -r is to set an option parser. -d is for debugging mode.
113
+ (e.g.) $ rgettext -r fooparser test.foo
114
+ The idea is from Kobayashi Noritada.
115
+ Fix a trivial bug by Kobayashi Noritada.
116
+
117
+ 2006-07-25 Masao Mutoh <mutoh@highway.ne.jp>
118
+
119
+ * lib/gettext/active_record.rb: Separate from rails.rb.
120
+
121
+ 2006-07-23 Masao Mutoh <mutoh@highway.ne.jp>
122
+
123
+ * lib/gettext/rails.rb: init_gettext manages plural textdomains.
124
+ bindtextdomain binds a domainname to ActionMailer::Base and ActionView::Base.
125
+
126
+ 2006-07-22 Masao Mutoh <mutoh@highway.ne.jp>
127
+
128
+ * lib/gettext/rails.rb: init_gettext finds the locale path with caller
129
+ not RAILS_ROOT now for supporting plugins which has app/controller directory
130
+ such as Rails Engines.
131
+ And init_gettext accepts :locale_path option to be able to set the locale
132
+ path manually.
133
+ * po/pt_BR/rails.po, rgettext.po: Updated by Joao Pedrosa.
134
+
135
+ 2006-07-17 Masao Mutoh <mutoh@highway.ne.jp>
136
+
137
+ * lib/gettext/rails.rb: bind the textdomain same with ApplictionController
138
+ to the class which includes ActiveRecord::Validations.
139
+
1
140
  2006-07-16 Masao Mutoh <mutoh@highway.ne.jp>
2
141
 
3
142
  * lib/gettext/rails.rb: Code cleanup.
data/NEWS CHANGED
@@ -1,3 +1,34 @@
1
+ = Ruby-GetText-Package-1.8.0 (2006-09-11)
2
+
3
+ * Support Chinese(Taiwan: zh_TW), Estonian(et: rails.po only)
4
+ * Add GetText.bindtextdomain_to(klass, domainname), .textdomain_to(klass, domainname)
5
+ * rgettext supports -r, -d options.
6
+ -r is to set an option parser. -d is for debugging mode.
7
+ (e.g.) $ rgettext -r fooparser test.foo
8
+ * Update translations: pt_BR, de, zh_TW,
9
+ * Code cleanup, fixed bugs.
10
+ * Enhance to support Ruby on Rails.
11
+ * init_gettext finds mo-files in /vendor/plugins/{plugin_name}/locale which has
12
+ app/controller directories such as Rails Engines.
13
+ And init_gettext accepts :locale_path option to be able to set the locale
14
+ path manually.
15
+ * init_gettext manages plural textdomains.
16
+ * Add before_init_gettext, after_init_gettext methods like as before/after_filter.
17
+ * Speed up(the sample blog is 1.5 times faster).
18
+ * gettext/active_record.rb from gettext/rails.rb.
19
+ * ActiveRecord::Validations is set the app's textdomain in init_gettext.
20
+ It means the class which includes ActiveRecord::Validtaions are localized with
21
+ the app's textdomain.
22
+ e.g.) You can use gettext methods in the subclass of ActiveForm[1]
23
+ http://www.realityforge.org/svn/code/active-form/trunk/
24
+ * Works rails edge again (http://dev.rubyonrails.org/ticket/5810)
25
+
26
+ Thanks to:
27
+ Translators: Joao Pedrosa(pt_BR), Partick Lenz(de), Erkki Eilonen(et),
28
+ LIN CHUNG-YI(zh_TW)
29
+ Bug reports and suggestions:
30
+ Kobayashi Noritada, Andreas Neuhaus, steve dp, Tsutomu Kuroda, Donald Piret
31
+
1
32
  = Ruby-GetText-Package-1.7.0 (2006-07-17)
2
33
 
3
34
  * GetText.current_textdomain_info for debuging
data/README CHANGED
@@ -20,6 +20,7 @@ Ruby-Gettext-Package
20
20
  * glade-2 XML file(.glade)
21
21
  * ERB file(.rhtml)
22
22
  * ActiveRecord(.rb)
23
+ * Others(with your own parsers)
23
24
  The po-file is compatible to GNU gettext.
24
25
 
25
26
  * rmsgfmt creates a mo-file from a po-file.
@@ -39,7 +40,17 @@ Ruby-Gettext-Package
39
40
  * ERB support (gettext/erb)
40
41
 
41
42
  * Ruby on Rails support (gettext/rails)
42
-
43
+ * before_init_gettext, init_gettext, after_init_gettext for initializing
44
+ GetText.
45
+ * ActionController, ActionView, ActionMailer and ActiveRecord are
46
+ localized in a textdomain.
47
+ * Validation messages in ActiveRecord are localized.
48
+ * The table/field names of ActiveRecord are extracted by rgettext
49
+ and translated in the application.
50
+ * plugins can have their own textdomains.
51
+ * ActionMailer supports ISO-2022-JP message in ja locale.
52
+
53
+ * String% is extended to use named argument such as "%{foo}" %{:foo => 1}
43
54
 
44
55
  Requirements
45
56
  ------------
@@ -109,10 +120,13 @@ License
109
120
  Translators
110
121
  -----------
111
122
  Chinese(Simplified)(zh_CN) - Yingfeng <blogyingfeng at gmail.com>
123
+ Chinese(Traditional)(zh_TW)- LIN CHUNG-YI <xmarsh at gmail.com>
112
124
  Czech(cs) - Karel Miarka <kajism at yahoo.com>
113
125
  Dutch(nl) - Menno Jonkers <ruby-gettext at jonkers.com>
126
+ Estonian(et) - Erkki Eilonen <erkki at itech.ee>
114
127
  French(fr) - Laurent Sansonetti <laurent.sansonetti at gmail.com>
115
- German(de) - Detlef Reichl <detlef.reichl at gmx.org>
128
+ German(de) - Patrick Lenz <patrick at limited-overload.de> (current)
129
+ Detlef Reichl <detlef.reichl at gmx.org>
116
130
  Sven Herzberg <herzi at abi02.de>
117
131
  Sascha Ebach <se at digitale-wertschoepfung.de>
118
132
  Greek(el) - Damphyr <damphyr at gmx.net>
@@ -128,19 +142,21 @@ Swedish(sv) - Nikolai Weibull <mailing-lists.ruby-talk at rawuncu
128
142
 
129
143
  Status of translations
130
144
  ----------------------
131
- Chinese(zh) - 1.7.0
132
- Czech(cs) - 1.7.0
133
- Dutch(nl) - 1.7.0
134
- English(default) - 1.7.0
135
- French(fr) - 1.7.0
136
- German(de) - 1.6.0
137
- Greek(el) - 1.6.0
138
- Spanish(es) - 1.7.0
139
- Italian(it) - 1.6.0
140
- Japanese(ja) - 1.7.0
141
- Korean(ko) - 1.7.0
142
- Portuguese(Brazil)(pt_BR) - 1.6.0
143
- Russian(ru) - 1.7.0
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
150
+ 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
155
+ 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
144
160
  Swedish(sv) - 0.8.0 (old)
145
161
 
146
162
  Maintainer
data/Rakefile CHANGED
@@ -102,13 +102,14 @@ end
102
102
 
103
103
  desc "Update pot/po files to match new version."
104
104
  task :updatepo do
105
+ rails = ["lib/gettext/rails.rb", "lib/gettext/active_record.rb"]
105
106
  #lib/gettext/*.rb -> rgettext.po
106
107
  GetText.update_pofiles("rgettext",
107
- Dir.glob("lib/**/*.rb") + ["src/poparser.ry"] - ["lib/gettext/rails.rb"],
108
+ Dir.glob("lib/**/*.rb") + ["src/poparser.ry"] - rails,
108
109
  "ruby-gettext #{GetText::VERSION}")
109
110
 
110
111
  #lib/gettext/rails.rb -> rails.po
111
- GetText.update_pofiles("rails", ["lib/gettext/rails.rb"],
112
+ GetText.update_pofiles("rails", rails,
112
113
  "ruby-gettext #{GetText::VERSION}")
113
114
  end
114
115
 
data/bin/rgettext CHANGED
@@ -7,7 +7,7 @@
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby.
9
9
 
10
- $Id: rgettext,v 1.8 2006/02/22 16:42:41 mutoh Exp $
10
+ $Id: rgettext,v 1.12 2006/09/10 15:08:32 mutoh Exp $
11
11
  =end
12
12
 
13
13
  begin
data/bin/rmsgfmt CHANGED
@@ -7,7 +7,7 @@
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby.
9
9
 
10
- $Id: rmsgfmt,v 1.7 2006/02/22 16:42:41 mutoh Exp $
10
+ $Id: rmsgfmt,v 1.11 2006/09/10 15:08:32 mutoh Exp $
11
11
  =end
12
12
 
13
13
  begin
data/bin/rmsgmerge CHANGED
@@ -7,7 +7,7 @@
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby.
9
9
 
10
- $Id: rmsgmerge,v 1.6 2006/02/22 16:42:41 mutoh Exp $
10
+ $Id: rmsgmerge,v 1.10 2006/09/10 15:08:32 mutoh Exp $
11
11
  =end
12
12
 
13
13
  begin
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/lib/gettext.rb CHANGED
@@ -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.15 2006/06/11 15:36:20 mutoh Exp $
13
+ $Id: gettext.rb,v 1.20 2006/09/10 15:08:32 mutoh Exp $
14
14
  =end
15
15
 
16
16
  require 'rbconfig'
@@ -49,7 +49,7 @@ module GetText
49
49
  # * :charset - output charset. This affect the current textdomain only. Generally, you should use GetText.set_output_charset instead.
50
50
  # The value is searched order by:
51
51
  # the value of Locale.set_output_charset > ENV["OUTPUT_CHARSET"] > this value > System default charset.
52
- # * Returns: the GetText::TextDomain.
52
+ # * Returns: the GetText::TextDomainManager.
53
53
  # Note: Don't use locale_, charset argument(not in options).
54
54
  # They are remained for backward compatibility.
55
55
  #
@@ -76,12 +76,25 @@ module GetText
76
76
  manager
77
77
  end
78
78
 
79
+ # Includes GetText module and bind a textdomain to a class.
80
+ # * klass: the target ruby class.
81
+ # * domainname: the textdomain name.
82
+ # * options: options as an Hash. See GetText.bindtextdomain.
83
+ def bindtextdomain_to(klass, domainname, options = {})
84
+ ret = nil
85
+ klass.module_eval {
86
+ include GetText
87
+ ret = bindtextdomain(domainname, options)
88
+ }
89
+ ret
90
+ end
91
+
79
92
  # Binds a existed textdomain to your program.
80
- # This is the same function with GetText.bindtextdomain but simpler than bindtextdomain.
93
+ # This is the same function with GetText.bindtextdomain but simpler(and faster) than bindtextdomain.
81
94
  # Notice that you need to call GetText.bindtextdomain first. If the domainname hasn't bound yet,
82
95
  # raises GetText::NoboundTextDomainError.
83
96
  # * domainname: a textdomain name.
84
- # * Returns: the GetText::TextDomain.
97
+ # * Returns: the GetText::TextDomainManager.
85
98
  def textdomain(domainname)
86
99
  domain = TextDomainManager.textdomain(domainname)
87
100
  raise NoboundTextDomainError, "#{domainname} is not bound." unless domain
@@ -90,31 +103,37 @@ module GetText
90
103
  manager = TextDomainManager.new(bound_target, Locale.get)
91
104
  @@__textdomainmanagers[bound_target] = manager
92
105
  end
93
- manager.add_textdomain(domainname)
94
106
  manager.set_locale(Locale.get)
107
+ manager.add_textdomain(domainname)
108
+ manager
95
109
  end
96
110
 
97
- TARGET_REGEXP = /\:\:/ # :nodoc:
111
+ # Includes GetText module and bind an exsited textdomain to a class.
112
+ # See textdomain for more detail.
113
+ # * klass: the target ruby class.
114
+ # * domainname: the textdomain name.
115
+ def textdomain_to(klass, domainname)
116
+ ret = nil
117
+ klass.module_eval {
118
+ include GetText
119
+ ret = textdomain(domainname)
120
+ }
121
+ ret
122
+ end
98
123
 
99
124
  # Iterates bound textdomains.
100
125
  # * klass: a class/module to find. Default is the class of self.
101
126
  # * ignore_targets: Ignore tragets.
102
127
  # * Returns: a bound GetText::TextDomain or nil.
103
128
  def each_textdomain(klass = bound_target, ignore_targets = []) #:nodoc:
104
- (klass.ancestors + [GetText]).each do |target|
129
+ bound_targets(klass).each do |target|
105
130
  unless ignore_targets.include? target
106
- ignore_targets << target
107
131
  manager = @@__textdomainmanagers[target]
108
132
  if manager
109
133
  manager.each{ |textdomain|
110
134
  yield textdomain
111
135
  }
112
136
  end
113
- if target.to_s =~ TARGET_REGEXP
114
- each_textdomain(Module.const_get($`), ignore_targets){|domain|
115
- yield domain
116
- }
117
- end
118
137
  end
119
138
  end
120
139
  self
@@ -128,6 +147,15 @@ module GetText
128
147
  end
129
148
  end
130
149
 
150
+ def bound_targets(klass) # :nodoc:
151
+ ret = []
152
+ ary = klass.name.split(/::/)
153
+ while(v = ary.shift)
154
+ ret.unshift(((ret.size == 0) ? eval(v) : ret[0].const_get(v)))
155
+ end
156
+ ((ret + klass.ancestors + [GetText]) & @@__textdomainmanagers.keys).uniq
157
+ end
158
+
131
159
  # call-seq:
132
160
  # gettext(msgid)
133
161
  # _(msgid)
@@ -213,7 +241,7 @@ module GetText
213
241
  msg
214
242
  end
215
243
 
216
- # Sets locale to the current class/module
244
+ # Sets the default locale to the current class/module
217
245
  #
218
246
  # Notice that you shouldn't use this for your own Libraries.
219
247
  # * locale: a locale string or Locale::Object.
@@ -232,7 +260,7 @@ module GetText
232
260
  ret.charset = output_charset if output_charset
233
261
  Locale.set(ret)
234
262
  else
235
- Locale.clear
263
+ Locale.set(nil)
236
264
  ret = Locale.get
237
265
  end
238
266
  if this_target_only
@@ -251,7 +279,7 @@ module GetText
251
279
  # Sets locale to the all textdomains.
252
280
  #
253
281
  # Notice that you shouldn't use this for your own Libraries.
254
- # * locale: a locale string or Locale::Object.
282
+ # * locale: a locale string or Locale::Object, otherwise nil to use default locale.
255
283
  # * Returns: self
256
284
  def set_locale_all(locale)
257
285
  ret = nil
@@ -261,24 +289,23 @@ module GetText
261
289
  else
262
290
  ret = Locale::Object.new(locale.to_s)
263
291
  end
264
- ret.charset = output_charset if output_charset
265
- Locale.set(ret)
292
+ Locale.set_current(ret)
266
293
  else
267
- Locale.set(nil)
294
+ Locale.set_current(nil)
268
295
  ret = Locale.get
269
296
  end
297
+ ret.charset = output_charset if output_charset
270
298
  TextDomainManager.each_all {|textdomain|
271
299
  textdomain.set_locale(ret)
272
300
  }
273
301
  self
274
302
  end
275
303
 
276
- # Same as GetText.set_locale.
304
+ # Same as GetText.set_locale_all.
277
305
  # * locale: a locale string
278
- # * src: internal usage only. You shouldn't use this.
279
306
  # * Returns: a locale string
280
307
  def locale=(locale)
281
- set_locale(locale)
308
+ set_locale_all(locale)
282
309
  locale
283
310
  end
284
311
 
@@ -363,7 +390,7 @@ module GetText
363
390
  alias :s_ :sgettext #:nodoc:
364
391
 
365
392
  module_function :bindtextdomain, :textdomain, :each_textdomain,
366
- :N_, :gettext, :_, :ngettext, :n_, :sgettext, :s_, :bound_target,
393
+ :N_, :gettext, :_, :ngettext, :n_, :sgettext, :s_, :bound_target, :bound_targets,
367
394
  :setlocale, :set_locale, :locale=, :set_locale_all, :locale, :charset=, :set_charset,
368
395
  :set_output_charset, :output_charset=, :output_charset, :current_textdomain_info
369
396
  end