How to cache page using gettext?

3 views
Skip to first unread message

Ye Dingding

unread,
Jul 4, 2007, 2:03:44 PM7/4/07
to rubyonra...@googlegroups.com
I use gettext to translate my application. But when i want to do caching, i met the problem?

How can i cache the page under different language, such as english, chinese.  Then it will auto-load the related html file depend on user's setting.

Does gettext support that caching mechanism?

Ye Dingding

unread,
Jul 7, 2007, 3:59:09 PM7/7/07
to rubyonra...@googlegroups.com
Does anyone have some experience about this, thanks.

Masao Mutoh

unread,
Jul 7, 2007, 9:38:01 PM7/7/07
to rubyonra...@googlegroups.com
Hi,

The newest Ruby-GetText-1.10.0 support Action/Fragment caching.

class ArticlesController < ApplicationController
caches_action :show # Action cache
:
def show
:
:
end

def create
@article = Article.new(params[:article])
if @article.save
expire_fragment(:action => "list") # Clear Flagment cache
expire_action(:action => "show") # Clear Action cache.
:
:
end
end

# app/views/articles/list.rhtml
<h1>Listing articles</h1>
<% cache do %> #Flagment cache.
Fragment cache
<% end %>

HTH,

--
.:% Masao Mutoh<mu...@highway.ne.jp>

Reply all
Reply to author
Forward
0 new messages