履歴: ソフトウェア/rails/言語ネゴシエーション
各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 21 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます
| 日時 | タイトル | 文字数 | 追加 | 削除 | 内容 | 差分 | 基準 |
|---|---|---|---|---|---|---|---|
| 2014/5/20 19:20:23 | ソフトウェア/rails/言語ネゴシエーション 最新版 | 3,891 | +1 | -1 | 表示 | 差分 | — |
| 2014/5/20 19:20:23 | ソフトウェア/rails/言語ネゴシエーション | 3,897 | +8 | -1 | 表示 | 差分 | 選択 |
| 2013/1/5 18:30:15 | ソフトウェア/rails/言語ネゴシエーション | 3,842 | +3 | -0 | 表示 | 差分 | 選択 |
| 2009/7/14 9:35:50 | ソフトウェア/rails/言語ネゴシエーション | 3,732 | +43 | -27 | 表示 | 差分 | 選択 |
| 2009/7/11 15:06:20 | ソフトウェア/rails/言語ネゴシエーション | 3,727 | +9 | -0 | 表示 | 差分 | 選択 |
| 2009/6/28 2:02:38 | ソフトウェア/rails/言語ネゴシエーション | 3,515 | +2 | -0 | 表示 | 差分 | 選択 |
| 2009/6/27 8:15:42 | ソフトウェア/rails/言語ネゴシエーション | 3,458 | +4 | -0 | 表示 | 差分 | 選択 |
| 2009/6/21 9:14:00 | ソフトウェア/rails/言語ネゴシエーション | 3,403 | +15 | -0 | 表示 | 差分 | 選択 |
| 2009/6/21 6:41:27 | ソフトウェア/rails/言語ネゴシエーション | 3,126 | +62 | -2793 | 表示 | 差分 | 選択 |
| 2009/6/10 11:14:13 | ソフトウェア/rails/言語ネゴシエーション | 84,051 | +327 | -1 | 表示 | 差分 | 選択 |
| 2009/6/10 3:14:21 | ソフトウェア/rails/言語ネゴシエーション | 73,730 | +459 | -3 | 表示 | 差分 | 選択 |
| 2009/6/9 15:42:54 | ソフトウェア/rails/言語ネゴシエーション | 58,379 | +247 | -473 | 表示 | 差分 | 選択 |
| 2009/6/9 11:29:37 | ソフトウェア/rails/言語ネゴシエーション | 66,074 | +317 | -40 | 表示 | 差分 | 選択 |
| 2009/6/8 20:22:16 | ソフトウェア/rails/言語ネゴシエーション | 58,607 | +75 | -2 | 表示 | 表示中 | 選択 |
| 2009/6/8 15:18:39 | ソフトウェア/rails/言語ネゴシエーション | 55,917 | +958 | -223 | 表示 | 差分 | 基準 |
| 2009/6/8 8:00:44 | ソフトウェア/rails/言語ネゴシエーション | 33,858 | +247 | -35 | 表示 | 差分 | 選択 |
| 2009/6/7 13:55:06 | ソフトウェア/rails/言語ネゴシエーション | 28,314 | +195 | -18 | 表示 | 差分 | 選択 |
| 2009/6/7 4:15:30 | ソフトウェア/rails/言語ネゴシエーション | 23,332 | +140 | -3 | 表示 | 差分 | 選択 |
| 2009/6/6 14:50:13 | ソフトウェア/rails/言語ネゴシエーション | 19,622 | +30 | -27 | 表示 | 差分 | 選択 |
| 2009/6/6 6:50:47 | ソフトウェア/rails/言語ネゴシエーション | 19,701 | +581 | -3 | 表示 | 差分 | 選択 |
| 2009/6/6 2:59:56 | ソフトウェア/rails/言語ネゴシエーション | 2,869 | — | — | 表示 | — | 選択 |
基準: ソフトウェア/rails/言語ネゴシエーション (2009/6/8 15:18:39) → 比較: ソフトウェア/rails/言語ネゴシエーション (2009/6/8 20:22:16)
@@ -10,7 +10,7 @@
rails アプリケーションの多言語化する方法を調べてみた。
rails のバージョンが上がっているせいと、それ以外の問題とで、
-結局かなりの部分を1から書いたのでメモメモ。
+結局かなりの部分を1から書いたのでメモしておく。
やりたい内容としては
+ views/*/*.html.ja.erb と views/*/*.html.en.erb とを両方作っておき、
@@ -1885,7 +1885,7 @@
残るはドキュメントとテストケースだ。
-* テスト [#z90f29b8]
+* テストケース [#z90f29b8]
プラグインのテストケースを書かなければ。
@@ -1937,7 +1937,80 @@
end
end
+* 手動テスト [#wd595311]
+ LANG:console
+ $ jed app/controllers/test_controller.rb
+ class TestController < ApplicationController
+ caches_page :pagecached
+ caches_action :actioncached
+ def index
+ end
+ def pagecached
+ end
+ def actioncached
+ end
+ def fragmentcached
+ end
+ def onlyja
+ end
+ def rendereaction
+ render :action=>:onlyja
+ end
+ def renderfile
+ render :file=>"renderfile_"
+ end
+ end
+ $ echo "Test <%= render :partial=>'ok' %>" > app/views/test/index.html.en.erb
+ $ echo "テスト <%= render :partial=>'ok' %>" > app/views/test/index.html.ja.erb
+ $ echo "Page cached" > app/views/test/pagecached.html.en.erb
+ $ echo "ページキャッシュ" > app/views/test/pagecached.html.ja.erb
+ $ echo "Action cached" > app/views/test/actioncached.html.en.erb
+ $ echo "アクションキャッシュ" > app/views/test/actioncached.html.ja.erb
+ $ echo "Fragment cached" > app/views/test/fragmentcached.html.en.erb
+ $ echo "フラグメントキャッシュ" > app/views/test/fragmentcached.html.ja.erb
+ $ echo "日本語のみ" > app/views/test/onlyja.html.ja.erb
+ $ echo "File" > app/views/test/renderfile_.html.en.erb
+ $ echo "ファイル" > app/views/test/renderfile_.html.ja.erb
+ $ rm public/test*
+ rm: cannot remove `public/test*': そのようなファイルやディレクトリはありません
+ $ alias wgetc="wget -qO- --load-cookies=tmp/wget.cookie --save-cookies=tmp/wget.cookie --keep-session-cookies --header='ACCEPT: text/html'"
+ $ jed public/.htaccess
+ RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+ $ wgetc --header="Accept-Language: en" http://localhost/negotiation/test
+ エラー: no route to "/negotiation/test"
+
+うまくいかない。。。
+
+ vendor/actionpack/CHANGELOG
+ *2.2 (November 21st, 2008)*
+ * AbstractRequest.relative_url_root is no longer automatically configured
+ by a HTTP header. It can now be set in your configuration environment with
+ config.action_controller.relative_url_root [Josh Peek]
+
+これみたい?~
+でもなんで fcgi の時だけだめなんだろう?
+
+ LANG:console
+ $ echo 'config.action_controller.relative_url_root = "/negotiation"' >> environments/production.rb
+ $ wgetc --header="Accept-Language: en" http://localhost/negotiation/test
+ 日本語: テスト ばっちり
+ $ rm tmp/wget.cookie
+ $ wgetc --header="Accept-Language: en" http://localhost/negotiation/test
+ English: Test OK
+ $ wgetc --header="Accept-Language: en" http://localhost/negotiation/test.ja
+ 日本語: テスト ばっちり
+ $ wgetc --header="Accept-Language: en" http://localhost/negotiation/test
+ 日本語: テスト ばっちり
+ $ wgetc http://localhost/negotiation/test/pagecached
+ 日本語: ページキャッシュ
+ $ ls public/test/*
+ public/test/pagecached.html.ja
+ $ wgetc http://localhost/negotiation/test/pagecached.en
+ English: Page cached
+ $ ls public/test/*
+ public/test/pagecached.html.en public/test/pagecached.html.ja
+
* コメント [#kfcbe2ab]
気づいた点など、ぜひとも突っ込みを入れて下さい。