gettext 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. data/ChangeLog +194 -0
  2. data/NEWS +49 -0
  3. data/README +28 -9
  4. data/Rakefile +54 -41
  5. data/bin/rgettext +2 -0
  6. data/bin/rmsgfmt +2 -0
  7. data/bin/rmsgmerge +24 -0
  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/es/LC_MESSAGES/rails.mo +0 -0
  13. data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
  14. data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
  15. data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
  16. data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
  17. data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
  18. data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
  19. data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
  20. data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
  21. data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
  22. data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
  23. data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
  24. data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
  25. data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
  26. data/lib/gettext.rb +17 -4
  27. data/lib/gettext/cgi.rb +34 -19
  28. data/lib/gettext/locale.rb +3 -13
  29. data/lib/gettext/locale_default.rb +2 -2
  30. data/lib/gettext/locale_win32.rb +27 -7
  31. data/lib/gettext/mo.rb +6 -1
  32. data/lib/gettext/parser/activerecord.rb +115 -0
  33. data/lib/gettext/parser/glade.rb +3 -1
  34. data/lib/gettext/parser/ruby.rb +56 -57
  35. data/lib/gettext/poparser.rb +297 -0
  36. data/lib/gettext/rails.rb +161 -3
  37. data/lib/gettext/rgettext.rb +19 -9
  38. data/lib/gettext/rmsgfmt.rb +7 -275
  39. data/lib/gettext/rmsgmerge.rb +381 -0
  40. data/lib/gettext/string.rb +26 -0
  41. data/lib/gettext/textdomain.rb +21 -18
  42. data/lib/gettext/utils.rb +55 -0
  43. data/lib/gettext/version.rb +1 -1
  44. data/po/cs/rails.po +83 -0
  45. data/po/cs/rgettext.po +104 -0
  46. data/po/de/rails.po +79 -0
  47. data/po/de/rgettext.po +72 -21
  48. data/po/es/rails.po +80 -0
  49. data/po/es/rgettext.po +75 -19
  50. data/po/fr/rails.po +81 -0
  51. data/po/fr/rgettext.po +75 -19
  52. data/po/it/rgettext.po +68 -17
  53. data/po/ja/rails.po +78 -0
  54. data/po/ja/rgettext.po +71 -20
  55. data/po/ko/rails.po +77 -0
  56. data/po/ko/rgettext.po +74 -22
  57. data/po/nl/rails.po +80 -0
  58. data/po/nl/rgettext.po +102 -0
  59. data/po/pt_BR/rails.po +79 -0
  60. data/po/pt_BR/rgettext.po +77 -24
  61. data/po/rails.pot +80 -0
  62. data/po/rgettext.pot +63 -13
  63. data/po/sv/rgettext.po +63 -15
  64. data/samples/cgi/cookie.cgi +5 -0
  65. data/samples/cgi/helloerb1.cgi +4 -0
  66. data/samples/cgi/helloerb2.cgi +5 -0
  67. data/samples/cgi/index.cgi +5 -0
  68. data/samples/cgi/locale/cs/LC_MESSAGES/helloerb1.mo +0 -0
  69. data/samples/cgi/locale/cs/LC_MESSAGES/helloerb2.mo +0 -0
  70. data/samples/cgi/locale/cs/LC_MESSAGES/hellolib.mo +0 -0
  71. data/samples/cgi/locale/cs/LC_MESSAGES/main.mo +0 -0
  72. data/samples/cgi/locale/fr/LC_MESSAGES/main.mo +0 -0
  73. data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
  74. data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
  75. data/samples/cgi/locale/ko/LC_MESSAGES/hellolib.mo +0 -0
  76. data/samples/cgi/locale/ko/LC_MESSAGES/main.mo +0 -0
  77. data/samples/cgi/locale/nl/LC_MESSAGES/helloerb1.mo +0 -0
  78. data/samples/cgi/locale/nl/LC_MESSAGES/helloerb2.mo +0 -0
  79. data/samples/cgi/locale/nl/LC_MESSAGES/hellolib.mo +0 -0
  80. data/samples/cgi/locale/nl/LC_MESSAGES/main.mo +0 -0
  81. data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb1.mo +0 -0
  82. data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb2.mo +0 -0
  83. data/samples/cgi/locale/pt_BR/LC_MESSAGES/hellolib.mo +0 -0
  84. data/samples/cgi/locale/pt_BR/LC_MESSAGES/main.mo +0 -0
  85. data/samples/cgi/po/cs/helloerb1.po +66 -0
  86. data/samples/cgi/po/cs/helloerb2.po +52 -0
  87. data/samples/cgi/po/cs/hellolib.po +25 -0
  88. data/samples/cgi/po/cs/main.po +78 -0
  89. data/samples/cgi/po/fr/main.po +8 -8
  90. data/samples/cgi/po/ko/helloerb1.po +2 -3
  91. data/samples/cgi/po/ko/helloerb2.po +1 -2
  92. data/samples/cgi/po/ko/hellolib.po +1 -2
  93. data/samples/cgi/po/ko/main.po +2 -3
  94. data/samples/cgi/po/nl/helloerb1.po +60 -0
  95. data/samples/cgi/po/nl/helloerb2.po +52 -0
  96. data/samples/cgi/po/nl/hellolib.po +24 -0
  97. data/samples/cgi/po/nl/main.po +76 -0
  98. data/samples/cgi/po/pt_BR/helloerb1.po +59 -0
  99. data/samples/cgi/po/pt_BR/helloerb2.po +51 -0
  100. data/samples/cgi/po/pt_BR/hellolib.po +22 -0
  101. data/samples/cgi/po/pt_BR/main.po +75 -0
  102. data/samples/locale/cs/LC_MESSAGES/hello.mo +0 -0
  103. data/samples/locale/cs/LC_MESSAGES/hello2.mo +0 -0
  104. data/samples/locale/cs/LC_MESSAGES/hello_noop.mo +0 -0
  105. data/samples/locale/cs/LC_MESSAGES/hello_plural.mo +0 -0
  106. data/samples/locale/cs/LC_MESSAGES/helloglade2.mo +0 -0
  107. data/samples/locale/cs/LC_MESSAGES/hellogtk.mo +0 -0
  108. data/samples/locale/cs/LC_MESSAGES/hellotk.mo +0 -0
  109. data/samples/locale/fr/LC_MESSAGES/helloglade2.mo +0 -0
  110. data/samples/locale/ko/LC_MESSAGES/hello.mo +0 -0
  111. data/samples/locale/ko/LC_MESSAGES/hello2.mo +0 -0
  112. data/samples/locale/ko/LC_MESSAGES/hello_noop.mo +0 -0
  113. data/samples/locale/ko/LC_MESSAGES/hello_plural.mo +0 -0
  114. data/samples/locale/ko/LC_MESSAGES/helloglade2.mo +0 -0
  115. data/samples/locale/ko/LC_MESSAGES/hellogtk.mo +0 -0
  116. data/samples/locale/ko/LC_MESSAGES/hellotk.mo +0 -0
  117. data/samples/locale/nl/LC_MESSAGES/hello.mo +0 -0
  118. data/samples/locale/nl/LC_MESSAGES/hello2.mo +0 -0
  119. data/samples/locale/nl/LC_MESSAGES/hello_noop.mo +0 -0
  120. data/samples/locale/nl/LC_MESSAGES/hello_plural.mo +0 -0
  121. data/samples/locale/nl/LC_MESSAGES/helloglade2.mo +0 -0
  122. data/samples/locale/nl/LC_MESSAGES/hellogtk.mo +0 -0
  123. data/samples/locale/nl/LC_MESSAGES/hellotk.mo +0 -0
  124. data/samples/locale/pt_BR/LC_MESSAGES/hello.mo +0 -0
  125. data/samples/locale/pt_BR/LC_MESSAGES/hello2.mo +0 -0
  126. data/samples/locale/pt_BR/LC_MESSAGES/hello_noop.mo +0 -0
  127. data/samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo +0 -0
  128. data/samples/locale/pt_BR/LC_MESSAGES/helloglade2.mo +0 -0
  129. data/samples/locale/pt_BR/LC_MESSAGES/hellogtk.mo +0 -0
  130. data/samples/locale/pt_BR/LC_MESSAGES/hellotk.mo +0 -0
  131. data/samples/po/cs/hello.po +23 -0
  132. data/samples/po/cs/hello2.po +31 -0
  133. data/samples/po/cs/hello_noop.po +27 -0
  134. data/samples/po/cs/hello_plural.po +26 -0
  135. data/samples/po/cs/helloglade2.po +37 -0
  136. data/samples/po/cs/hellogtk.po +23 -0
  137. data/samples/po/cs/hellotk.po +23 -0
  138. data/samples/po/fr/helloglade2.po +2 -2
  139. data/samples/po/hello.pot +1 -0
  140. data/samples/po/hello2.pot +1 -0
  141. data/samples/po/hello_noop.pot +2 -1
  142. data/samples/po/hello_plural.pot +6 -2
  143. data/samples/po/helloglade2.pot +8 -3
  144. data/samples/po/hellotk.pot +4 -0
  145. data/samples/po/ko/hello.po +1 -2
  146. data/samples/po/ko/hello2.po +1 -2
  147. data/samples/po/ko/hello_noop.po +1 -2
  148. data/samples/po/ko/hello_plural.po +1 -2
  149. data/samples/po/ko/helloglade2.po +2 -2
  150. data/samples/po/ko/hellogtk.po +1 -2
  151. data/samples/po/ko/hellotk.po +1 -2
  152. data/samples/po/nl/hello.po +24 -0
  153. data/samples/po/nl/hello2.po +32 -0
  154. data/samples/po/nl/hello_noop.po +28 -0
  155. data/samples/po/nl/hello_plural.po +26 -0
  156. data/samples/po/nl/helloglade2.po +31 -0
  157. data/samples/po/nl/hellogtk.po +24 -0
  158. data/samples/po/nl/hellotk.po +24 -0
  159. data/samples/po/pt_BR/hello.po +6 -5
  160. data/samples/po/pt_BR/hello2.po +6 -5
  161. data/samples/po/pt_BR/hello_noop.po +6 -5
  162. data/samples/po/pt_BR/hello_plural.po +6 -6
  163. data/samples/po/pt_BR/helloglade2.po +6 -5
  164. data/samples/po/pt_BR/hellogtk.po +6 -5
  165. data/samples/po/pt_BR/hellotk.po +6 -5
  166. data/samples/rails/README +21 -15
  167. data/samples/rails/Rakefile +10 -1
  168. data/samples/rails/app/controllers/application.rb +10 -18
  169. data/samples/rails/app/controllers/blog_controller.rb +1 -5
  170. data/samples/rails/app/helpers/blog_helper.rb +1 -1
  171. data/samples/rails/app/models/article.rb +15 -0
  172. data/samples/rails/app/views/blog/_form.rhtml +2 -2
  173. data/samples/rails/config/boot.rb +17 -0
  174. data/samples/rails/config/database.yml +5 -3
  175. data/samples/rails/config/environment.rb +40 -75
  176. data/samples/rails/config/environments/development.rb +12 -7
  177. data/samples/rails/config/environments/production.rb +17 -6
  178. data/samples/rails/config/environments/test.rb +8 -6
  179. data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
  180. data/samples/rails/locale/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
  181. data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
  182. data/samples/rails/locale/de/LC_MESSAGES/gettext_plugin.mo +0 -0
  183. data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
  184. data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
  185. data/samples/rails/locale/es/LC_MESSAGES/gettext_plugin.mo +0 -0
  186. data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
  187. data/samples/rails/locale/fr/LC_MESSAGES/{lang_helper.mo → gettext_plugin.mo} +0 -0
  188. data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
  189. data/samples/rails/locale/ja/LC_MESSAGES/{lang_helper.mo → gettext_plugin.mo} +0 -0
  190. data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
  191. data/samples/rails/locale/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
  192. data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
  193. data/samples/rails/locale/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
  194. data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
  195. data/samples/rails/locale/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
  196. data/samples/rails/po/blog.pot +57 -37
  197. data/samples/rails/po/cs/blog.po +116 -0
  198. data/samples/rails/po/cs/gettext_plugin.po +29 -0
  199. data/samples/rails/po/de/blog.po +70 -51
  200. data/samples/rails/po/de/{lang_helper.po → gettext_plugin.po} +4 -5
  201. data/samples/rails/po/en/blog.po +111 -0
  202. data/samples/rails/po/es/blog.po +67 -47
  203. data/samples/rails/po/es/{lang_helper.po → gettext_plugin.po} +5 -5
  204. data/samples/rails/po/fr/blog.po +65 -45
  205. data/samples/rails/po/fr/{lang_helper.po → gettext_plugin.po} +4 -4
  206. data/samples/rails/po/{lang_helper.pot → gettext_plugin.pot} +4 -4
  207. data/samples/rails/po/ja/blog.po +64 -44
  208. data/samples/rails/po/ja/{lang_helper.po → gettext_plugin.po} +4 -4
  209. data/samples/rails/po/ko/blog.po +65 -46
  210. data/samples/rails/po/ko/{lang_helper.po → gettext_plugin.po} +5 -6
  211. data/samples/rails/po/nl/blog.po +115 -0
  212. data/samples/rails/po/nl/gettext_plugin.po +28 -0
  213. data/samples/rails/po/pt_BR/blog.po +109 -0
  214. data/samples/rails/po/pt_BR/gettext_plugin.po +27 -0
  215. data/samples/rails/public/images/rails.png +0 -0
  216. data/samples/rails/public/index.html +272 -71
  217. data/samples/rails/public/javascripts/controls.js +441 -166
  218. data/samples/rails/public/javascripts/dragdrop.js +261 -279
  219. data/samples/rails/public/javascripts/effects.js +657 -277
  220. data/samples/rails/public/javascripts/prototype.js +911 -223
  221. data/samples/rails/public/robots.txt +1 -0
  222. data/samples/rails/public/stylesheets/scaffold.css +1 -1
  223. data/samples/rails/script/about +3 -0
  224. data/samples/rails/script/breakpointer +3 -4
  225. data/samples/rails/script/console +3 -23
  226. data/samples/rails/script/destroy +3 -7
  227. data/samples/rails/script/generate +3 -7
  228. data/samples/rails/script/performance/benchmarker +3 -0
  229. data/samples/rails/script/performance/profiler +3 -0
  230. data/samples/rails/script/plugin +3 -0
  231. data/samples/rails/script/process/reaper +3 -0
  232. data/samples/rails/script/process/spawner +3 -0
  233. data/samples/rails/script/process/spinner +3 -0
  234. data/samples/rails/script/runner +3 -29
  235. data/samples/rails/script/server +3 -49
  236. data/samples/rails/vendor/plugins/gettext/init.rb +19 -0
  237. data/samples/rails/vendor/{lang_helper.rb → plugins/gettext/lib/gettext_plugin.rb} +15 -11
  238. data/src/poparser.ry +171 -0
  239. data/test/gettext_runner.rb +3 -1
  240. data/test/gettext_test.rb +56 -31
  241. data/test/gettext_test_cgi.rb +12 -0
  242. data/test/gettext_test_parser.rb +3 -0
  243. data/test/gettext_test_string.rb +14 -0
  244. data/test/locale/cr/LC_MESSAGES/plural.mo +0 -0
  245. data/test/locale/da/LC_MESSAGES/plural.mo +0 -0
  246. data/test/locale/da/LC_MESSAGES/plural_error.mo +0 -0
  247. data/test/locale/fr/LC_MESSAGES/plural.mo +0 -0
  248. data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -0
  249. data/test/locale/ir/LC_MESSAGES/plural.mo +0 -0
  250. data/test/locale/la/LC_MESSAGES/plural.mo +0 -0
  251. data/test/locale/li/LC_MESSAGES/plural.mo +0 -0
  252. data/test/locale/po/LC_MESSAGES/plural.mo +0 -0
  253. data/test/locale/sl/LC_MESSAGES/plural.mo +0 -0
  254. data/test/po/cr/plural.po +3 -3
  255. data/test/po/da/plural.po +2 -2
  256. data/test/po/da/plural_error.po +2 -1
  257. data/test/po/fr/plural.po +2 -2
  258. data/test/po/fr/plural_error.po +2 -1
  259. data/test/po/ir/plural.po +3 -3
  260. data/test/po/la/plural.po +3 -3
  261. data/test/po/li/plural.po +3 -3
  262. data/test/po/po/plural.po +3 -3
  263. data/test/po/sl/plural.po +4 -4
  264. data/test/test.sh +1 -0
  265. data/test/test_rubyparser.rb +20 -0
  266. metadata +678 -551
  267. data/README.ja +0 -115
  268. data/data/locale/de/LC_MESSAGES/rmsgfmt.mo +0 -0
  269. data/data/locale/es/LC_MESSAGES/rmsgfmt.mo +0 -0
  270. data/data/locale/fr/LC_MESSAGES/rmsgfmt.mo +0 -0
  271. data/data/locale/it/LC_MESSAGES/rmsgfmt.mo +0 -0
  272. data/data/locale/ja/LC_MESSAGES/rmsgfmt.mo +0 -0
  273. data/data/locale/ko/LC_MESSAGES/rmsgfmt.mo +0 -0
  274. data/data/locale/pt_BR/LC_MESSAGES/rmsgfmt.mo +0 -0
  275. data/data/locale/sv/LC_MESSAGES/rmsgfmt.mo +0 -0
  276. data/po/de/rmsgfmt.po +0 -45
  277. data/po/es/rmsgfmt.po +0 -43
  278. data/po/fr/rmsgfmt.po +0 -43
  279. data/po/it/rmsgfmt.po +0 -44
  280. data/po/ja/rmsgfmt.po +0 -43
  281. data/po/ko/rmsgfmt.po +0 -40
  282. data/po/pt_BR/rmsgfmt.po +0 -42
  283. data/po/rmsgfmt.pot +0 -40
  284. data/po/sv/rmsgfmt.po +0 -43
  285. data/samples/rails/locale/de/LC_MESSAGES/lang_helper.mo +0 -0
  286. data/samples/rails/locale/es/LC_MESSAGES/lang_helper.mo +0 -0
  287. data/samples/rails/locale/ko/LC_MESSAGES/lang_helper.mo +0 -0
  288. data/src/rmsgfmt.ry +0 -233
@@ -204,9 +204,18 @@ end
204
204
  #
205
205
  # Added for Ruby-GetText-Package
206
206
  #
207
- require 'gettext/rmsgfmt'
207
+
208
+ require 'gettext/utils'
208
209
  desc "Create mo-files for L10n"
209
210
  task :makemo do
210
211
  GetText.create_mofiles(true, "po", "locale")
211
212
  end
212
213
 
214
+ desc "Update pot/po files to match new version."
215
+ task :updatepo do
216
+ GetText.update_pofiles("blog", Dir.glob("{app,lib}/**/*.{rb,rhtml}"),
217
+ "blog 1.1.0")
218
+
219
+ GetText.update_pofiles("gettext_plugin", Dir.glob("vendor/**/*.{rb,rhtml}"),
220
+ "gettext_plugin 1.1.0")
221
+ end
@@ -7,31 +7,23 @@
7
7
  # Require 'gettext/rails' first.
8
8
  require 'gettext/rails'
9
9
 
10
- # lang_helper is sample helper. It has its own textdomain(lang_helper).
11
- # (See vendor/lang_helper.rb).
12
- require 'lang_helper'
13
-
14
10
  class ApplicationController < ActionController::Base
15
- # for lang_helper.
16
- helper LangHelper
17
- include LangHelper
18
-
19
11
  # Initialize GetText and Content-Type.
20
12
  # You need to call this once a request from WWW browser.
21
13
  # You can select the scope of the textdomain.
22
- # 1. If you call bindtextdomain in ApplicationControler,
14
+ # 1. If you call init_gettext in ApplicationControler,
23
15
  # The textdomain apply whole your application.
24
- # 2. If you call bindtextdomain in each controllers
16
+ # 2. If you call init_gettext in each controllers
25
17
  # (In this sample, blog_controller.rb is applicable)
26
18
  # The textdomains are applied to each controllers/views.
27
- before_filter :init_gettext
28
- def init_gettext
29
- # The locale is set automatically or use Cookie value, parameter "lang".
30
- bindtextdomain("blog", request.cgi) #You need to pass CGI object first.
19
+ init_gettext "blog" # textdomain, charset = "UTF-8", content_type = "text/html"
31
20
 
32
- # Or set locale forcely.
33
- #bindtextdomain("blog", request.cgi, "ja")
34
-
35
- @headers["Content-Type"] = "text/html; charset=UTF-8"
21
+ =begin
22
+ # You can override the main part of "init_gettext" by yourself.
23
+ def init_gettext_main
24
+ GetText.output_charset = "UTF-8"
25
+ bindtextdomain("blog", request.cgi) #You need to pass CGI object first.
26
+ @headers["Content-Type"] = "text/html; charset=#{GetText.output_charset}"
36
27
  end
28
+ =end
37
29
  end
@@ -8,11 +8,7 @@ class BlogController < ApplicationController
8
8
  # If you want to have textdomains each as controllers.
9
9
  # You need to bind textdomain here.
10
10
 
11
- #before_filter :init_gettext
12
- #def init_gettext
13
- # bindtextdomain("blog", request.cgi) #You need to pass CGI object first.
14
- # @headers["Content-Type"] = "text/html; charset=UTF-8"
15
- #end
11
+ init_gettext "blog"
16
12
 
17
13
  def index
18
14
  list
@@ -35,7 +35,7 @@ module BlogHelper
35
35
  articles = BlogController.new.list
36
36
  %Q[
37
37
  <div class="navigation">
38
- <img src="http://web.rubyonrails.com/images/rails_logo_remix.gif" />
38
+ <img src="/images/rails.png" width="100" height="100" />
39
39
  <div class="window">
40
40
  #{show_language}
41
41
  </div>
@@ -1,2 +1,17 @@
1
1
  class Article < ActiveRecord::Base
2
+ # With default error messages.
3
+ validates_presence_of :title
4
+ validates_length_of :description, :minimum => 10
5
+
6
+
7
+ # With your own message with L10n.
8
+ # old style(Backward compatibility).
9
+ # blog.po in RAILS_ROOT/po/*/ is used.
10
+ # validates_presence_of :title, :message => _("can't be empty")
11
+ # validates_length_of :description, :minimum => 10, :message => _("is too short (min is %d characters)")
12
+
13
+ # new style (you can use %{fn} and %d freely in the message)
14
+ # blog.po in RAILS_ROOT/po/*/ is used.
15
+ # validates_presence_of :title, :message => _("%{fn} can't be empty!")
16
+ # validates_length_of :description, :minimum => 10, :message => _("%{fn} is too short (min is %d characters)")
2
17
  end
@@ -15,10 +15,10 @@
15
15
  <!--[form:article]-->
16
16
  <p><label for="article_lastupdate"><%= _("Lastupdate") %></label><br/>
17
17
  <%= date_select 'article', 'lastupdate', :use_month_numbers => true %></p>
18
- <p><label for="article_title"><%= _("Title") %></label><br/>
18
+ <p><label for="article_title"><%= _("Title: Required.") %></label><br/>
19
19
  <%= text_field 'article', 'title' %></p>
20
20
 
21
- <p><label for="article_description"><%= _("Description") %></label><br/>
21
+ <p><label for="article_description"><%= _("Description: More than 10 characters.") %></label><br/>
22
22
  <%= text_area 'article', 'description' %></p>
23
23
 
24
24
  <!--[eoform:article]-->
@@ -0,0 +1,17 @@
1
+ unless defined?(RAILS_ROOT)
2
+ root_path = File.join(File.dirname(__FILE__), '..')
3
+ unless RUBY_PLATFORM =~ /mswin32/
4
+ require 'pathname'
5
+ root_path = Pathname.new(root_path).cleanpath(true).to_s
6
+ end
7
+ RAILS_ROOT = root_path
8
+ end
9
+
10
+ if File.directory?("#{RAILS_ROOT}/vendor/rails")
11
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
12
+ else
13
+ require 'rubygems'
14
+ require 'initializer'
15
+ end
16
+
17
+ Rails::Initializer.run(:set_load_path)
@@ -11,7 +11,7 @@ development:
11
11
  # adapter: postgresql
12
12
  # database: blog
13
13
  # host: localhost
14
- # username: mutoh
14
+ # username: postgres
15
15
  # password:
16
16
 
17
17
  # Warning: The database defined as 'test' will be erased and
@@ -26,7 +26,9 @@ test:
26
26
 
27
27
  production:
28
28
  adapter: mysql
29
- database: rails_production
29
+ socket: /var/lib/mysql/mysql.sock
30
+ # socket: /tmp/mysql.sock
31
+ database: blog
30
32
  host: localhost
31
33
  username: root
32
- password:
34
+ password:
@@ -1,88 +1,53 @@
1
- # Load the Rails framework and configure your application.
2
- # You can include your own configuration at the end of this file.
3
- #
4
- # Be sure to restart your webserver when you modify this file.
1
+ # Be sure to restart your web server when you modify this file.
5
2
 
6
- $KCODE = "u"
3
+ # Uncomment below to force Rails into production mode when
4
+ # you don't control web/app server and can't set it the proper way
5
+ # ENV['RAILS_ENV'] ||= 'production'
7
6
 
8
- # The path to the root directory of your application.
9
- RAILS_ROOT = File.join(File.dirname(__FILE__), '..')
7
+ # Bootstrap the Rails environment, frameworks, and default configuration
8
+ require File.join(File.dirname(__FILE__), 'boot')
10
9
 
11
- # The environment your application is currently running. Don't set
12
- # this here; put it in your webserver's configuration as the RAILS_ENV
13
- # environment variable instead.
14
- #
15
- # See config/environments/*.rb for environment-specific configuration.
16
- RAILS_ENV = ENV['RAILS_ENV'] || 'development'
10
+ Rails::Initializer.run do |config|
11
+ # Settings in config/environments/* take precedence those specified here
12
+
13
+ # Skip frameworks you're not going to use
14
+ # config.frameworks -= [ :action_web_service, :action_mailer ]
17
15
 
16
+ # Add additional load paths for your own custom dirs
17
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
18
18
 
19
- # Load the Rails framework. Mock classes for testing come first.
20
- ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
19
+ # Force all environments to use the same logger level
20
+ # (by default production uses :info, the others :debug)
21
+ # config.log_level = :debug
21
22
 
22
- # Then model subdirectories.
23
- ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
24
- ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
23
+ # Use the database for sessions instead of the file system
24
+ # (create the session table with 'rake create_sessions_table')
25
+ # config.action_controller.session_store = :active_record_store
25
26
 
26
- # Followed by the standard includes.
27
- ADDITIONAL_LOAD_PATHS.concat %w(
28
- app
29
- app/models
30
- app/controllers
31
- app/helpers
32
- app/apis
33
- components
34
- config
35
- lib
36
- vendor
37
- vendor/rails/railties
38
- vendor/rails/railties/lib
39
- vendor/rails/actionpack/lib
40
- vendor/rails/activesupport/lib
41
- vendor/rails/activerecord/lib
42
- vendor/rails/actionmailer/lib
43
- vendor/rails/actionwebservice/lib
44
- ).map { |dir| "#{RAILS_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) }
27
+ # Enable page/fragment caching by setting a file-based store
28
+ # (remember to create the caching directory and make it readable to the application)
29
+ # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
45
30
 
46
- # Prepend to $LOAD_PATH
47
- ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
31
+ # Activate observers that should always be running
32
+ # config.active_record.observers = :cacher, :garbage_collector
48
33
 
49
- # Require Rails libraries.
50
- require 'rubygems' unless File.directory?("#{RAILS_ROOT}/vendor/rails")
34
+ # Make Active Record use UTC-base instead of local time
35
+ # config.active_record.default_timezone = :utc
36
+
37
+ # Use Active Record's schema dumper instead of SQL when creating the test database
38
+ # (enables use of different database adapters for development and test environments)
39
+ # config.active_record.schema_format = :ruby
51
40
 
52
- require 'active_support'
53
- require 'active_record'
54
- require 'action_controller'
55
- require 'action_mailer'
56
- require 'action_web_service'
57
-
58
- # Environment-specific configuration.
59
- require_dependency "environments/#{RAILS_ENV}"
60
- ActiveRecord::Base.configurations = File.open("#{RAILS_ROOT}/config/database.yml") { |f| YAML::load(f) }
61
- ActiveRecord::Base.establish_connection
62
-
63
-
64
- # Configure defaults if the included environment did not.
65
- begin
66
- RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
67
- RAILS_DEFAULT_LOGGER.level = (RAILS_ENV == 'production' ? Logger::INFO : Logger::DEBUG)
68
- rescue StandardError
69
- RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
70
- RAILS_DEFAULT_LOGGER.level = Logger::WARN
71
- RAILS_DEFAULT_LOGGER.warn(
72
- "Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0666. " +
73
- "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
74
- )
41
+ # See Rails::Configuration for more options
75
42
  end
76
43
 
77
- [ActiveRecord, ActionController, ActionMailer].each { |mod| mod::Base.logger ||= RAILS_DEFAULT_LOGGER }
78
- [ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
79
-
80
- # Set up routes.
81
- ActionController::Routing::Routes.reload
82
-
83
- Controllers = Dependencies::LoadingModule.root(
84
- File.join(RAILS_ROOT, 'app', 'controllers'),
85
- File.join(RAILS_ROOT, 'components')
86
- )
44
+ # Add new inflection rules using the following format
45
+ # (all these examples are active by default):
46
+ # Inflector.inflections do |inflect|
47
+ # inflect.plural /^(ox)$/i, '\1en'
48
+ # inflect.singular /^(ox)en/i, '\1'
49
+ # inflect.irregular 'person', 'people'
50
+ # inflect.uncountable %w( fish sheep )
51
+ # end
87
52
 
88
- # Include your app's configuration here:
53
+ # Include your application configuration below
@@ -1,14 +1,19 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
1
3
  # In the development environment your application's code is reloaded on
2
4
  # every request. This slows down response time but is perfect for development
3
5
  # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
4
7
 
5
8
  # Log error messages when you accidentally call methods on nil.
6
- require 'active_support/whiny_nil'
9
+ config.whiny_nils = true
10
+
11
+ # Enable the breakpoint server that script/breakpointer connects to
12
+ config.breakpoint_server = true
7
13
 
8
- # Reload code; show full error reports; disable caching.
9
- Dependencies.mechanism = :load
10
- ActionController::Base.consider_all_requests_local = true
11
- ActionController::Base.perform_caching = false
14
+ # Show full error reports and disable caching
15
+ config.action_controller.consider_all_requests_local = true
16
+ config.action_controller.perform_caching = false
12
17
 
13
- # The breakpoint server port that script/breakpointer connects to.
14
- BREAKPOINT_SERVER_PORT = 42531
18
+ # Don't care if the mailer can't send
19
+ config.action_mailer.raise_delivery_errors = false
@@ -1,8 +1,19 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
1
3
  # The production environment is meant for finished, "live" apps.
2
- # Code is not reloaded between requests, full error reports are disabled,
3
- # and caching is turned on.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Use a different logger for distributed setups
8
+ # config.logger = SyslogLogger.new
9
+
10
+
11
+ # Full error reports are disabled and caching is turned on
12
+ config.action_controller.consider_all_requests_local = false
13
+ config.action_controller.perform_caching = true
14
+
15
+ # Enable serving of images, stylesheets, and javascripts from an asset server
16
+ # config.action_controller.asset_host = "http://assets.example.com"
4
17
 
5
- # Don't reload code; don't show full error reports; enable caching.
6
- Dependencies.mechanism = :require
7
- ActionController::Base.consider_all_requests_local = false
8
- ActionController::Base.perform_caching = true
18
+ # Disable delivery errors if you bad email addresses should just be ignored
19
+ # config.action_mailer.raise_delivery_errors = false
@@ -1,17 +1,19 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
1
3
  # The test environment is used exclusively to run your application's
2
4
  # test suite. You never need to work with it otherwise. Remember that
3
5
  # your test database is "scratch space" for the test suite and is wiped
4
6
  # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
5
8
 
6
9
  # Log error messages when you accidentally call methods on nil.
7
- require 'active_support/whiny_nil'
10
+ config.whiny_nils = true
8
11
 
9
- # Don't reload code; show full error reports; disable caching.
10
- Dependencies.mechanism = :require
11
- ActionController::Base.consider_all_requests_local = true
12
- ActionController::Base.perform_caching = false
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
13
15
 
14
16
  # Tell ActionMailer not to deliver emails to the real world.
15
17
  # The :test delivery method accumulates sent emails in the
16
18
  # ActionMailer::Base.deliveries array.
17
- ActionMailer::Base.delivery_method = :test
19
+ config.action_mailer.delivery_method = :test
@@ -9,8 +9,8 @@
9
9
  #, fuzzy
10
10
  msgid ""
11
11
  msgstr ""
12
- "Project-Id-Version: 1.0\n"
13
- "POT-Creation-Date: 2005-08-28 00:10+0900\n"
12
+ "Project-Id-Version: blog 1.1.0\n"
13
+ "POT-Creation-Date: 2005-12-23 01:29+0900\n"
14
14
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
15
15
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
16
16
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -19,72 +19,92 @@ msgstr ""
19
19
  "Content-Transfer-Encoding: 8bit\n"
20
20
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
21
21
 
22
- #: app/controllers/blog_controller.rb:22
23
- msgid "Article was successfully created."
22
+ #: app/helpers/blog_helper.rb:43
23
+ msgid "Ruby Links"
24
24
  msgstr ""
25
25
 
26
- #: app/controllers/blog_controller.rb:36
27
- msgid "Article was successfully updated."
26
+ #: app/helpers/blog_helper.rb:51
27
+ msgid "Old articles"
28
28
  msgstr ""
29
29
 
30
- #: app/helpers/blog_helper.rb:31
31
- msgid "Ruby Links"
30
+ #: app/models/article.rb:-
31
+ msgid "Article"
32
32
  msgstr ""
33
33
 
34
- #: app/helpers/blog_helper.rb:39
35
- msgid "Old articles"
34
+ #: app/models/article.rb:-
35
+ msgid "Article|Id"
36
36
  msgstr ""
37
37
 
38
- #: app/views/blog/_form.rhtml:4
39
- msgid "Lastupdate"
38
+ #: app/models/article.rb:-
39
+ msgid "Article|Title"
40
40
  msgstr ""
41
41
 
42
- #: app/views/blog/_form.rhtml:6
43
- msgid "Title"
42
+ #: app/models/article.rb:-
43
+ msgid "Article|Description"
44
44
  msgstr ""
45
45
 
46
- #: app/views/blog/_form.rhtml:9
47
- msgid "Description"
46
+ #: app/models/article.rb:-
47
+ msgid "Article|Lastupdate"
48
48
  msgstr ""
49
49
 
50
- #: app/views/blog/edit.rhtml:1
51
- msgid "Editing article"
50
+ #: app/controllers/blog_controller.rb:37
51
+ msgid "Article was successfully created."
52
52
  msgstr ""
53
53
 
54
- #: app/views/blog/edit.rhtml:5 app/views/blog/show.rhtml:4
55
- msgid "Edit"
54
+ #: app/controllers/blog_controller.rb:51
55
+ msgid "Article was successfully updated."
56
56
  msgstr ""
57
57
 
58
- #: app/views/blog/edit.rhtml:8
59
- msgid "Show"
58
+ #: app/views/blog/new.rhtml:13 app/views/blog/list.rhtml:15
59
+ msgid "New article"
60
60
  msgstr ""
61
61
 
62
- #: app/views/blog/edit.rhtml:9
63
- msgid "Destroy"
62
+ #: app/views/blog/new.rhtml:17
63
+ msgid "Create"
64
64
  msgstr ""
65
65
 
66
- #: app/views/blog/edit.rhtml:9
67
- msgid "Are you sure?"
66
+ #: app/views/blog/new.rhtml:20 app/views/blog/edit.rhtml:21
67
+ #: app/views/blog/show.rhtml:17
68
+ msgid "Back"
68
69
  msgstr ""
69
70
 
70
- #: app/views/blog/edit.rhtml:10 app/views/blog/new.rhtml:8
71
- #: app/views/blog/show.rhtml:5
72
- msgid "Back"
71
+ #: app/views/blog/_form.rhtml:16
72
+ msgid "Lastupdate"
73
73
  msgstr ""
74
74
 
75
- #: app/views/blog/list.rhtml:1 app/views/blog/show.rhtml:1
76
- #: app/views/layouts/blog.rhtml:3
77
- msgid "GetText Sample Blog on RoR"
75
+ #: app/views/blog/_form.rhtml:18
76
+ msgid "Title: Required."
78
77
  msgstr ""
79
78
 
80
- #: app/views/blog/list.rhtml:3 app/views/blog/new.rhtml:1
81
- msgid "New article"
79
+ #: app/views/blog/_form.rhtml:21
80
+ msgid "Description: More than 10 characters."
81
+ msgstr ""
82
+
83
+ #: app/views/blog/list.rhtml:13 app/views/blog/show.rhtml:13
84
+ #: app/views/layouts/blog.rhtml:14
85
+ msgid "GetText Sample Blog on RoR"
82
86
  msgstr ""
83
87
 
84
- #: app/views/blog/list.rhtml:6
88
+ #: app/views/blog/list.rhtml:18
85
89
  msgid "No articles were found."
86
90
  msgstr ""
87
91
 
88
- #: app/views/blog/new.rhtml:5
89
- msgid "Create"
92
+ #: app/views/blog/edit.rhtml:12
93
+ msgid "Editing article"
94
+ msgstr ""
95
+
96
+ #: app/views/blog/edit.rhtml:16 app/views/blog/show.rhtml:16
97
+ msgid "Edit"
98
+ msgstr ""
99
+
100
+ #: app/views/blog/edit.rhtml:19
101
+ msgid "Show"
102
+ msgstr ""
103
+
104
+ #: app/views/blog/edit.rhtml:20
105
+ msgid "Destroy"
106
+ msgstr ""
107
+
108
+ #: app/views/blog/edit.rhtml:20
109
+ msgid "Are you sure?"
90
110
  msgstr ""