# How to cache page using gettext?

**URL:** <https://www.ruby-forum.com/t/how-to-cache-page-using-gettext/108568>\
**Category:** Rails\
**Created:** [July 4, 2007, 8:04pm UTC](https://www.ruby-forum.com/t/how-to-cache-page-using-gettext/108568 "2007-07-04T20:04:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ye\_Dingding](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Ye\_Dingding](https://www.ruby-forum.com/u/Ye_Dingding)\
**Post date:** [July 4, 2007, 8:04pm UTC](https://www.ruby-forum.com/t/how-to-cache-page-using-gettext/108568/1 "2007-07-04T20:04:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ye\_Dingding](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Ye\_Dingding](https://www.ruby-forum.com/u/Ye_Dingding)\
**Post date:** [July 7, 2007, 10:00pm UTC](https://www.ruby-forum.com/t/how-to-cache-page-using-gettext/108568/2 "2007-07-07T22:00:16Z")

</div>

Does anyone have some experience about this, thanks.

---

<div class="post-metadata">

**Author:** ![Ye\_Dingding](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/49beb7/32.png) [@Ye\_Dingding](https://www.ruby-forum.com/u/Ye_Dingding)\
**Post date:** [July 8, 2007, 3:38am UTC](https://www.ruby-forum.com/t/how-to-cache-page-using-gettext/108568/3 "2007-07-08T03:38:51Z")

</div>

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

# Listing articles
\<% cache do %\> #Flagment cache. Fragment cache \<% end %\>

HTH,

On Sun, 8 Jul 2007 03:59:09 +0800  
“Ye Dingding” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Does gettext support that caching mechanism?

–  
.:% Masao M.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
