Page caching for multilingual site


I would like to cache the pages of my website.

My website is available in 2 languages.
When you switch from one language to another, the URL remains the
same, but the articles are displayed in the appropriate language.

So, if I enable caching, the .html page /content/details/123.html is
written on the disk, and is accessed next time the same URL is

The problem is that if the page is first accessed in French, and then
accessed in English, the page will be displayed in French (from the
cache) the second time too.

Does anyone have a clue to help me find a solution?

Thanks in advance for your help.


Does anyone have a clue to help me find a solution?

I’d go with the obvious one: include the language code in the url.
Without this, pages would not be bookmarkable/shareable.


Yes, I would agree. As the cool kids say, that would be the RESTful way
to do it.
What are you doing now, storing the language in the session?

Switching to a URL-based solution should be painless. Just change your
routes to something like
mapconnect ‘:controller/:action/:language/:id’
and change your actions accordingly.

I’ll try something like that.
Thanks for your help.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs