gettext 1.9.0 → 1.10.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.
- data/ChangeLog +122 -1
- data/NEWS +21 -0
- data/README +30 -22
- data/data/locale/bs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/bs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/eo/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/eo/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/et/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/hr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/hr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nb/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nb/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
- data/lib/gettext.rb +119 -37
- data/lib/gettext/active_record.rb +51 -31
- data/lib/gettext/locale_win32.rb +2 -1
- data/lib/gettext/parser/active_record.rb +2 -2
- data/lib/gettext/parser/ruby.rb +2 -2
- data/lib/gettext/poparser.rb +19 -14
- data/lib/gettext/rails.rb +104 -50
- data/lib/gettext/rails_compat.rb +16 -0
- data/lib/gettext/rgettext.rb +37 -3
- data/lib/gettext/textdomain.rb +45 -6
- data/lib/gettext/utils.rb +7 -0
- data/lib/gettext/version.rb +1 -1
- data/po/bs/rails.po +148 -0
- data/po/bs/rgettext.po +131 -0
- data/po/ca/rails.po +45 -26
- data/po/ca/rgettext.po +21 -21
- data/po/cs/rails.po +46 -24
- data/po/cs/rgettext.po +21 -21
- data/po/de/rails.po +46 -27
- data/po/de/rgettext.po +21 -21
- data/po/el/rails.po +46 -25
- data/po/el/rgettext.po +22 -22
- data/po/eo/rails.po +49 -30
- data/po/eo/rgettext.po +21 -21
- data/po/es/rails.po +45 -24
- data/po/es/rgettext.po +21 -21
- data/po/et/rails.po +49 -30
- data/po/fr/rails.po +47 -28
- data/po/fr/rgettext.po +31 -29
- data/po/hr/rails.po +148 -0
- data/po/hr/rgettext.po +131 -0
- data/po/it/rails.po +42 -24
- data/po/it/rgettext.po +21 -21
- data/po/ja/rails.po +43 -25
- data/po/ja/rgettext.po +21 -21
- data/po/ko/rails.po +44 -24
- data/po/ko/rgettext.po +21 -21
- data/po/nb/rails.po +140 -0
- data/po/nb/rgettext.po +127 -0
- data/po/nl/rails.po +50 -30
- data/po/nl/rgettext.po +21 -21
- data/po/pt_BR/rails.po +48 -29
- data/po/pt_BR/rgettext.po +21 -21
- data/po/rails.pot +42 -24
- data/po/rgettext.pot +21 -21
- data/po/ru/rails.po +50 -31
- data/po/ru/rgettext.po +21 -21
- data/po/sv/rgettext.po +21 -21
- data/po/vi/rails.po +141 -0
- data/po/vi/rgettext.po +126 -0
- data/po/zh/rails.po +60 -43
- data/po/zh/rgettext.po +22 -22
- data/po/zh_TW/rails.po +61 -43
- data/po/zh_TW/rgettext.po +22 -22
- data/samples/cgi/locale/bs/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/bs/helloerb1.po +59 -0
- data/samples/cgi/po/bs/helloerb2.po +51 -0
- data/samples/cgi/po/bs/hellolib.po +23 -0
- data/samples/cgi/po/bs/main.po +83 -0
- data/samples/cgi/po/hr/helloerb1.po +59 -0
- data/samples/cgi/po/hr/helloerb2.po +51 -0
- data/samples/cgi/po/hr/hellolib.po +23 -0
- data/samples/cgi/po/hr/main.po +83 -0
- data/samples/cgi/po/nb/helloerb1.po +58 -0
- data/samples/cgi/po/nb/helloerb2.po +50 -0
- data/samples/cgi/po/nb/hellolib.po +22 -0
- data/samples/cgi/po/nb/main.po +82 -0
- data/samples/cgi/po/vi/helloerb1.po +65 -0
- data/samples/cgi/po/vi/helloerb2.po +52 -0
- data/samples/cgi/po/vi/hellolib.po +24 -0
- data/samples/cgi/po/vi/main.po +77 -0
- data/samples/locale/bs/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/ja/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/po/bs/hello.po +23 -0
- data/samples/po/bs/hello2.po +31 -0
- data/samples/po/bs/hello_noop.po +27 -0
- data/samples/po/bs/hello_plural.po +26 -0
- data/samples/po/bs/helloglade2.po +31 -0
- data/samples/po/bs/hellogtk.po +23 -0
- data/samples/po/bs/hellotk.po +23 -0
- data/samples/po/hr/hello.po +23 -0
- data/samples/po/hr/hello2.po +31 -0
- data/samples/po/hr/hello_noop.po +27 -0
- data/samples/po/hr/hello_plural.po +26 -0
- data/samples/po/hr/helloglade2.po +31 -0
- data/samples/po/hr/hellogtk.po +23 -0
- data/samples/po/hr/hellotk.po +23 -0
- data/samples/po/ja/hello_plural.po +1 -1
- data/samples/po/nb/hello.po +22 -0
- data/samples/po/nb/hello2.po +31 -0
- data/samples/po/nb/hello_noop.po +26 -0
- data/samples/po/nb/hello_plural.po +24 -0
- data/samples/po/nb/helloglade2.po +30 -0
- data/samples/po/nb/hellogtk.po +22 -0
- data/samples/po/nb/hellotk.po +22 -0
- data/samples/po/vi/hello.po +23 -0
- data/samples/po/vi/hello2.po +31 -0
- data/samples/po/vi/hello_noop.po +27 -0
- data/samples/po/vi/hello_plural.po +26 -0
- data/samples/po/vi/helloglade2.po +38 -0
- data/samples/po/vi/hellogtk.po +23 -0
- data/samples/po/vi/hellotk.po +24 -0
- data/samples/rails/locale/bs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/hr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nb/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/vi/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/po/bs/blog.po +106 -0
- data/samples/rails/po/hr/blog.po +106 -0
- data/samples/rails/po/nb/blog.po +104 -0
- data/samples/rails/po/vi/blog.po +110 -0
- data/samples/rails/vendor/plugins/gettext/locale/bs/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/hr/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/nb/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/vi/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/po/bs/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/hr/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/nb/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/vi/gettext_plugin.po +28 -0
- data/src/poparser.ry +9 -4
- data/test/README +2 -0
- data/test/Rakefile +2 -0
- data/test/db/mysql.drop.sql +4 -0
- data/test/db/mysql.sql +44 -0
- data/test/gettext_test.rb +51 -13
- data/test/gettext_test_active_record.rb +33 -0
- data/test/gettext_test_parser.rb +5 -0
- data/test/gettext_test_rails_caching.rb +211 -0
- data/test/locale/da/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/fr/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/active_record.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/test_nsgettext.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/test_sgettext.mo +0 -0
- data/test/locale/la/LC_MESSAGES/plural_error.mo +0 -0
- data/test/po/da/plural_error.po +3 -3
- data/test/po/fr/plural.po +6 -0
- data/test/po/fr/plural_error.po +3 -3
- data/test/po/ja/plural.po +6 -0
- data/test/po/ja/plural_error.po +2 -2
- data/test/po/ja/test_nsgettext.po +65 -0
- data/test/po/la/plural_error.po +3 -3
- data/test/rails/README +5 -0
- data/test/rails/Rakefile +35 -0
- data/test/rails/app/controllers/application.rb +8 -0
- data/test/rails/app/controllers/articles_controller.rb +61 -0
- data/test/rails/app/controllers/mailer_controller.rb +19 -0
- data/test/rails/app/helpers/application_helper.rb +3 -0
- data/test/rails/app/helpers/articles_helper.rb +2 -0
- data/test/rails/app/helpers/mailer_helper.rb +2 -0
- data/test/rails/app/models/article.rb +5 -0
- data/test/rails/app/models/mailer.rb +38 -0
- data/test/rails/app/models/user.rb +3 -0
- data/test/rails/app/views/articles/_form.rhtml +13 -0
- data/test/rails/app/views/articles/edit.rhtml +9 -0
- data/test/rails/app/views/articles/list.rhtml +30 -0
- data/test/rails/app/views/articles/list_fr.rhtml +1 -0
- data/test/rails/app/views/articles/multi_error_messages_for.rhtml +19 -0
- data/test/rails/app/views/articles/new.rhtml +8 -0
- data/test/rails/app/views/articles/show.rhtml +28 -0
- data/test/rails/app/views/layouts/application.rhtml +14 -0
- data/test/rails/app/views/layouts/mailer.rhtml +20 -0
- data/test/rails/app/views/mailer/coverpage.rhtml +6 -0
- data/test/rails/app/views/mailer/coverpage_fr.rhtml +6 -0
- data/test/rails/app/views/mailer/singlepart.rhtml +3 -0
- data/test/rails/app/views/mailer/singlepart_fr.rhtml +3 -0
- data/test/rails/config/boot.rb +45 -0
- data/test/rails/config/database.yml +36 -0
- data/test/rails/config/environment.rb +64 -0
- data/test/rails/config/environments/development.rb +21 -0
- data/test/rails/config/environments/production.rb +18 -0
- data/test/rails/config/environments/test.rb +19 -0
- data/test/rails/config/routes.rb +23 -0
- data/test/rails/db/schema.rb +27 -0
- data/test/rails/log/development.log +29 -0
- data/test/rails/log/test.log +329 -0
- data/test/rails/po/ja/rails_test.po +142 -0
- data/test/rails/po/rails_test.pot +147 -0
- data/test/rails/public/404.html +30 -0
- data/test/rails/public/500.html +30 -0
- data/test/rails/public/dispatch.cgi +10 -0
- data/test/rails/public/dispatch.fcgi +24 -0
- data/test/rails/public/dispatch.rb +10 -0
- data/test/rails/public/favicon.ico +0 -0
- data/test/rails/public/images/rails.png +0 -0
- data/test/rails/public/index.html +277 -0
- data/test/rails/public/javascripts/application.js +2 -0
- data/test/rails/public/javascripts/controls.js +833 -0
- data/test/rails/public/javascripts/dragdrop.js +942 -0
- data/test/rails/public/javascripts/effects.js +1088 -0
- data/test/rails/public/javascripts/prototype.js +2515 -0
- data/test/rails/public/robots.txt +1 -0
- data/test/rails/public/stylesheets/scaffold.css +74 -0
- data/test/rails/script/about +3 -0
- data/test/rails/script/breakpointer +3 -0
- data/test/rails/script/console +3 -0
- data/test/rails/script/destroy +3 -0
- data/test/rails/script/generate +3 -0
- data/test/rails/script/performance/benchmarker +3 -0
- data/test/rails/script/performance/profiler +3 -0
- data/test/rails/script/plugin +3 -0
- data/test/rails/script/process/inspector +3 -0
- data/test/rails/script/process/reaper +3 -0
- data/test/rails/script/process/spawner +3 -0
- data/test/rails/script/runner +3 -0
- data/test/rails/script/server +3 -0
- data/test/rails/test/fixtures/articles.yml +11 -0
- data/test/rails/test/functional/articles_controller_test.rb +109 -0
- data/test/rails/test/functional/mailer_controller_test.rb +93 -0
- data/test/rails/test/integration/general_stories_test.rb +58 -0
- data/test/rails/test/result/en/create_error.html +95 -0
- data/test/rails/test/result/en/list.html +65 -0
- data/test/rails/test/result/en/multi_error_messages_for.html +153 -0
- data/test/rails/test/result/en/multipart.html +67 -0
- data/test/rails/test/result/en/new.html +95 -0
- data/test/rails/test/result/en/show.html +50 -0
- data/test/rails/test/result/en/singlepart.html +10 -0
- data/test/rails/test/result/fr/list.html +15 -0
- data/test/rails/test/result/fr/multipart.html +67 -0
- data/test/rails/test/result/fr/singlepart.html +10 -0
- data/test/rails/test/result/ja/create_error.html +95 -0
- data/test/rails/test/result/ja/list.html +65 -0
- data/test/rails/test/result/ja/multi_error_messages_for.html +153 -0
- data/test/rails/test/result/ja/multipart.html +67 -0
- data/test/rails/test/result/ja/new.html +95 -0
- data/test/rails/test/result/ja/show.html +50 -0
- data/test/rails/test/result/ja/singlepart.html +10 -0
- data/test/rails/test/test_helper.rb +28 -0
- data/test/rails/test/unit/article_test.rb +18 -0
- data/test/test.sh +4 -0
- data/test/test_nsgettext.rb +44 -0
- data/test/test_rubyparser_n_.rb +10 -0
- metadata +587 -288
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
|
3
|
+
|
|
4
|
+
class ApplicationController < ActionController::Base
|
|
5
|
+
# Pick a unique cookie name to distinguish our session data from others'
|
|
6
|
+
session :session_key => '_rails_session_id'
|
|
7
|
+
init_gettext "rails_test"
|
|
8
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
class ArticlesController < ApplicationController
|
|
2
|
+
def index
|
|
3
|
+
list
|
|
4
|
+
render :action => 'list'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
|
|
8
|
+
verify :method => :post, :only => [ :destroy, :create, :update ],
|
|
9
|
+
:redirect_to => { :action => :list }
|
|
10
|
+
|
|
11
|
+
def list
|
|
12
|
+
@article_pages, @articles = paginate :articles, :per_page => 10
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def show
|
|
16
|
+
@article = Article.find(params[:id])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def new
|
|
20
|
+
@article = Article.new
|
|
21
|
+
@article.lastupdate = Date.new(2007, 4, 1)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def create
|
|
25
|
+
@article = Article.new(params[:article])
|
|
26
|
+
if @article.save
|
|
27
|
+
flash[:notice] = _('Article was successfully created.')
|
|
28
|
+
redirect_to :action => 'list'
|
|
29
|
+
else
|
|
30
|
+
render :action => 'new'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def edit
|
|
35
|
+
@article = Article.find(params[:id])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def multi_error_messages_for
|
|
39
|
+
@user = User.new
|
|
40
|
+
@user.lastupdate = Date.new(2007, 4, 1)
|
|
41
|
+
@article = Article.new
|
|
42
|
+
@article.lastupdate = Date.new(2007, 4, 1)
|
|
43
|
+
@user.valid?
|
|
44
|
+
@article.valid?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def update
|
|
48
|
+
@article = Article.find(params[:id])
|
|
49
|
+
if @article.update_attributes(params[:article])
|
|
50
|
+
flash[:notice] = _('Article was successfully updated.')
|
|
51
|
+
redirect_to :action => 'show', :id => @article
|
|
52
|
+
else
|
|
53
|
+
render :action => 'edit'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def destroy
|
|
58
|
+
Article.find(params[:id]).destroy
|
|
59
|
+
redirect_to :action => 'list'
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class MailerController < ApplicationController
|
|
2
|
+
layout "mailer"
|
|
3
|
+
|
|
4
|
+
init_gettext "rails_test"
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
render :nothing => true, :layout => true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def singlepart
|
|
11
|
+
Mailer.deliver_singlepart
|
|
12
|
+
render :text => Mailer.create_singlepart.encoded, :layout => true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def multipart
|
|
16
|
+
Mailer.deliver_multipart
|
|
17
|
+
render :text => Mailer.create_multipart.encoded, :layout => true
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
class Mailer < ActionMailer::Base
|
|
2
|
+
def multipart
|
|
3
|
+
@recipients = "mutoh@highway.ne.jp"
|
|
4
|
+
@from = "mutoh@highway.ne.jp"
|
|
5
|
+
@subject = _("multipart test mail")
|
|
6
|
+
@sent_on = Time.gm("2007-01-01 00:00:00")
|
|
7
|
+
@mime_version = "1.0"
|
|
8
|
+
@body = nil
|
|
9
|
+
@charset = nil
|
|
10
|
+
@content_type = "multipart/mixed"
|
|
11
|
+
|
|
12
|
+
attachments = Dir.glob("#{RAILS_ROOT}/public/images/*").select{|f| File.file?(f)}
|
|
13
|
+
|
|
14
|
+
part(:content_type => "text/plain", :charset => "iso-2022-jp") do |coverpage|
|
|
15
|
+
coverpage.body = render_message("coverpage", :name => "foo")
|
|
16
|
+
coverpage.transfer_encoding = "7bit"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
attachments.each do |attachment|
|
|
20
|
+
attachment "application/octet-stream" do |attach|
|
|
21
|
+
attach.content_disposition = "attachment"
|
|
22
|
+
attach.charset = nil
|
|
23
|
+
attach.filename = File.basename(attachment)
|
|
24
|
+
attach.transfer_encoding = "base64"
|
|
25
|
+
attach.body = File.read(attachment)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
@body
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def singlepart
|
|
32
|
+
recipients "mutoh@highway.ne.jp"
|
|
33
|
+
from "mutoh@highway.ne.jp"
|
|
34
|
+
subject _("singlepart test mail")
|
|
35
|
+
sent_on Time.gm("2007-01-01 00:00:00")
|
|
36
|
+
body["name"] = "foo"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%= error_messages_for 'article' %>
|
|
2
|
+
|
|
3
|
+
<!--[form:article]-->
|
|
4
|
+
<p><label for="article_title"><%= _("Title") %></label><br/>
|
|
5
|
+
<%= text_field 'article', 'title' %></p>
|
|
6
|
+
|
|
7
|
+
<p><label for="article_description"><%= _("Description") %></label><br/>
|
|
8
|
+
<%= text_area 'article', 'description' %></p>
|
|
9
|
+
|
|
10
|
+
<p><label for="article_lastupdate"><%= _("Lastupdate") %></label><br/>
|
|
11
|
+
<%= date_select 'article', 'lastupdate' %></p>
|
|
12
|
+
<!--[eoform:article]-->
|
|
13
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<h1><%= _("Editing article") %></h1>
|
|
2
|
+
|
|
3
|
+
<% form_tag :action => 'update', :id => @article do %>
|
|
4
|
+
<%= render :partial => 'form' %>
|
|
5
|
+
<%= submit_tag _('Edit') %>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
<%= link_to _('Show'), :action => 'show', :id => @article %> |
|
|
9
|
+
<%= link_to _('Back'), :action => 'list' %>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<h1><%= _("Listing articles") %></h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<% for column in Article.content_columns %>
|
|
6
|
+
<th><%= column.human_name %></th>
|
|
7
|
+
<% end %>
|
|
8
|
+
</tr>
|
|
9
|
+
|
|
10
|
+
<% for article in @articles %>
|
|
11
|
+
<tr>
|
|
12
|
+
<% for column in Article.content_columns %>
|
|
13
|
+
<td><%=h article.send(column.name) %></td>
|
|
14
|
+
<% end %>
|
|
15
|
+
<td><%= link_to _('Show'), :action => 'show', :id => article %></td>
|
|
16
|
+
<td><%= link_to _('Edit'), :action => 'edit', :id => article %></td>
|
|
17
|
+
<td><%= link_to _('Destroy'), { :action => 'destroy', :id => article }, :confirm => _('Are you sure?'), :method => :post %></td>
|
|
18
|
+
</tr>
|
|
19
|
+
<% end %>
|
|
20
|
+
</table>
|
|
21
|
+
|
|
22
|
+
<%= link_to 'Previous page', { :page => @article_pages.current.previous } if @article_pages.current.previous %>
|
|
23
|
+
<%= link_to 'Next page', { :page => @article_pages.current.next } if @article_pages.current.next %>
|
|
24
|
+
|
|
25
|
+
<br />
|
|
26
|
+
|
|
27
|
+
<%= link_to _('New article'), :action => 'new' %>
|
|
28
|
+
<br />
|
|
29
|
+
<br />
|
|
30
|
+
<%= link_to 'error_messages_for Test', :action => 'multi_error_messages_for' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>This is in French</h1>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%= error_messages_for 'article', 'user', :object_name => _("Contents") %>
|
|
2
|
+
|
|
3
|
+
<!--[form:article]-->
|
|
4
|
+
<p><label for="article_title"><%= _("Title") %></label><br/>
|
|
5
|
+
<%= text_field 'article', 'title' %></p>
|
|
6
|
+
|
|
7
|
+
<p><label for="article_description"><%= _("Description") %></label><br/>
|
|
8
|
+
<%= text_area 'article', 'description' %></p>
|
|
9
|
+
|
|
10
|
+
<p><label for="article_lastupdate"><%= _("Lastupdate") %></label><br/>
|
|
11
|
+
<%= date_select 'article', 'lastupdate' %></p>
|
|
12
|
+
|
|
13
|
+
<p><label for="user_name"><%= _("Name") %></label><br/>
|
|
14
|
+
<%= text_field 'user', 'name' %></p>
|
|
15
|
+
|
|
16
|
+
<p><label for="user_lastupdate"><%= _("Lastupdate") %></label><br/>
|
|
17
|
+
<%= date_select 'user', 'lastupdate' %></p>
|
|
18
|
+
<!--[eoform:article]-->
|
|
19
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<% for column in Article.content_columns %>
|
|
2
|
+
<p>
|
|
3
|
+
<b><%= column.human_name %>:</b> <%=h @article.send(column.name) %>
|
|
4
|
+
</p>
|
|
5
|
+
<% end %>
|
|
6
|
+
|
|
7
|
+
<%= link_to _('Edit'), :action => 'edit', :id => @article %> |
|
|
8
|
+
<%= link_to _('Back'), :action => 'list' %>
|
|
9
|
+
|
|
10
|
+
<br/>
|
|
11
|
+
<h2>test for distance_of_time_in_words</h2>
|
|
12
|
+
<% from = Time.mktime(2004, 3, 6, 21, 45, 0) %>
|
|
13
|
+
<%= distance_of_time_in_words(from, from + 0.seconds, true) %><br/>
|
|
14
|
+
<%= distance_of_time_in_words(from, from + 5.seconds, true) %><br/>
|
|
15
|
+
<%= distance_of_time_in_words(from, from + 20.seconds, true) %><br/>
|
|
16
|
+
<%= distance_of_time_in_words(from, from + 40.seconds, true) %><br/>
|
|
17
|
+
<%= distance_of_time_in_words(from, from + 60.seconds, true) %><br/>
|
|
18
|
+
<%= distance_of_time_in_words(from, from + 1.minutes + 30.seconds) %><br/>
|
|
19
|
+
<%= distance_of_time_in_words(from, from + 44.minutes + 30.seconds) %><br/>
|
|
20
|
+
<%= distance_of_time_in_words(from, from + 89.minutes + 30.seconds) %><br/>
|
|
21
|
+
<%= distance_of_time_in_words(from, from + 23.hours + 59.minutes + 30.seconds) %><br/>
|
|
22
|
+
<%= distance_of_time_in_words(from, from + 47.hours + 59.minutes + 30.seconds) %><br/>
|
|
23
|
+
<%= distance_of_time_in_words(from, from + 29.days + 23.hours + 59.minutes + 30.seconds) %><br/>
|
|
24
|
+
<%= distance_of_time_in_words(from, from + 59.days + 23.hours + 59.minutes + 30.seconds) %><br/>
|
|
25
|
+
<%= distance_of_time_in_words(from, from + 1.years - 30.seconds) %><br/>
|
|
26
|
+
<%= distance_of_time_in_words(from, from + 2.years - 30.seconds) %><br/>
|
|
27
|
+
|
|
28
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
4
|
+
<title>Ruby-GetText-Package Test Application</title>
|
|
5
|
+
<link href="/stylesheets/scaffold.css" media="screen" rel="Stylesheet" type="text/css" />
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
|
|
9
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<meta http-equiv="content-type" content="text/html;charset=ISO-2022-JP" />
|
|
4
|
+
<title>ActionMailer test page for Ruby-GetText-Package</title>
|
|
5
|
+
</head>
|
|
6
|
+
|
|
7
|
+
<body>
|
|
8
|
+
<h1>ActionMailer test page for Ruby-GetText-Package</h1>
|
|
9
|
+
|
|
10
|
+
| <a href="/mailer/singlepart?lang=ja">singlepart(ja)</a>
|
|
11
|
+
| <a href="/mailer/singlepart?lang=en">singlepart(en)</a>
|
|
12
|
+
| <a href="/mailer/multipart?lang=ja">multipart(ja)</a>
|
|
13
|
+
| <a href="/mailer/multipart?ct=multipart%2Fmixed&lang=ja">force multipart(ja)</a>
|
|
14
|
+
| <a href="/mailer/multipart?lang=en">multipart(en)</a>
|
|
15
|
+
|
|
16
|
+
<pre>
|
|
17
|
+
<%= @content_for_layout -%>
|
|
18
|
+
</pre>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
|
2
|
+
|
|
3
|
+
unless defined?(RAILS_ROOT)
|
|
4
|
+
root_path = File.join(File.dirname(__FILE__), '..')
|
|
5
|
+
|
|
6
|
+
unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
|
|
7
|
+
require 'pathname'
|
|
8
|
+
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
RAILS_ROOT = root_path
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
unless defined?(Rails::Initializer)
|
|
15
|
+
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
|
16
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
|
17
|
+
else
|
|
18
|
+
require 'rubygems'
|
|
19
|
+
|
|
20
|
+
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
|
21
|
+
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
|
22
|
+
rails_gem_version = $1
|
|
23
|
+
|
|
24
|
+
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
|
25
|
+
# Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems
|
|
26
|
+
rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
|
|
27
|
+
|
|
28
|
+
if rails_gem
|
|
29
|
+
gem "rails", "=#{rails_gem.version.version}"
|
|
30
|
+
require rails_gem.full_gem_path + '/lib/initializer'
|
|
31
|
+
else
|
|
32
|
+
STDERR.puts %(Cannot find gem for Rails ~>#{version}.0:
|
|
33
|
+
Install the missing gem with 'gem install -v=#{version} rails', or
|
|
34
|
+
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
|
35
|
+
)
|
|
36
|
+
exit 1
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
gem "rails"
|
|
40
|
+
require 'initializer'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
Rails::Initializer.run(:set_load_path)
|
|
45
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
|
|
2
|
+
#
|
|
3
|
+
# Install the MySQL driver:
|
|
4
|
+
# gem install mysql
|
|
5
|
+
# On MacOS X:
|
|
6
|
+
# gem install mysql -- --include=/usr/local/lib
|
|
7
|
+
# On Windows:
|
|
8
|
+
# gem install mysql
|
|
9
|
+
# Choose the win32 build.
|
|
10
|
+
# Install MySQL and put its /bin directory on your path.
|
|
11
|
+
#
|
|
12
|
+
# And be sure to use new-style password hashing:
|
|
13
|
+
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
|
14
|
+
development:
|
|
15
|
+
adapter: mysql
|
|
16
|
+
database: rails_unittest
|
|
17
|
+
username: root
|
|
18
|
+
password:
|
|
19
|
+
socket: /var/lib/mysql/mysql.sock
|
|
20
|
+
|
|
21
|
+
# Warning: The database defined as 'test' will be erased and
|
|
22
|
+
# re-generated from your development database when you run 'rake'.
|
|
23
|
+
# Do not set this db to the same as development or production.
|
|
24
|
+
test:
|
|
25
|
+
adapter: mysql
|
|
26
|
+
database: rails_unittest
|
|
27
|
+
username: root
|
|
28
|
+
password:
|
|
29
|
+
socket: /var/lib/mysql/mysql.sock
|
|
30
|
+
|
|
31
|
+
production:
|
|
32
|
+
adapter: mysql
|
|
33
|
+
database: rails_unittest
|
|
34
|
+
username: root
|
|
35
|
+
password:
|
|
36
|
+
socket: /var/lib/mysql/mysql.sock
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Be sure to restart your web server when you modify this file.
|
|
2
|
+
|
|
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'
|
|
6
|
+
|
|
7
|
+
$KCODE = "U"
|
|
8
|
+
|
|
9
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
|
10
|
+
RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION
|
|
11
|
+
|
|
12
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
|
13
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
|
14
|
+
|
|
15
|
+
Rails::Initializer.run do |config|
|
|
16
|
+
# Settings in config/environments/* take precedence over those specified here
|
|
17
|
+
|
|
18
|
+
# Skip frameworks you're not going to use (only works if using vendor/rails)
|
|
19
|
+
# config.frameworks -= [ :action_web_service, :action_mailer ]
|
|
20
|
+
|
|
21
|
+
# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
|
|
22
|
+
# config.plugins = %W( exception_notification ssl_requirement )
|
|
23
|
+
|
|
24
|
+
# Add additional load paths for your own custom dirs
|
|
25
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
|
26
|
+
|
|
27
|
+
# Force all environments to use the same logger level
|
|
28
|
+
# (by default production uses :info, the others :debug)
|
|
29
|
+
# config.log_level = :debug
|
|
30
|
+
|
|
31
|
+
# Use the database for sessions instead of the file system
|
|
32
|
+
# (create the session table with 'rake db:sessions:create')
|
|
33
|
+
# config.action_controller.session_store = :active_record_store
|
|
34
|
+
|
|
35
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
36
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
37
|
+
# like if you have constraints or database-specific column types
|
|
38
|
+
# config.active_record.schema_format = :sql
|
|
39
|
+
|
|
40
|
+
# Activate observers that should always be running
|
|
41
|
+
# config.active_record.observers = :cacher, :garbage_collector
|
|
42
|
+
|
|
43
|
+
# Make Active Record use UTC-base instead of local time
|
|
44
|
+
# config.active_record.default_timezone = :utc
|
|
45
|
+
|
|
46
|
+
# See Rails::Configuration for more options
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Add new inflection rules using the following format
|
|
50
|
+
# (all these examples are active by default):
|
|
51
|
+
# Inflector.inflections do |inflect|
|
|
52
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
|
53
|
+
# inflect.singular /^(ox)en/i, '\1'
|
|
54
|
+
# inflect.irregular 'person', 'people'
|
|
55
|
+
# inflect.uncountable %w( fish sheep )
|
|
56
|
+
# end
|
|
57
|
+
|
|
58
|
+
# Add new mime types for use in respond_to blocks:
|
|
59
|
+
# Mime::Type.register "text/richtext", :rtf
|
|
60
|
+
# Mime::Type.register "application/x-mobile", :mobile
|
|
61
|
+
|
|
62
|
+
# Include your application configuration below
|
|
63
|
+
|
|
64
|
+
require 'gettext/rails'
|