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?
Does anyone have some experience about this, thanks.
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,