Caching + routing

Newby here!

I have an application that has pages that are translated. Clicking on
flags changes the language. That is working nicely, but, for the
‘guest’ area I would like to cache these pages as they never change.
My problem is that the page has the same url for all the languages.
I have an action that does this:
def set_lang
set_language(params[:language])
redirect_to(session[:current_page])
end

Then the page renders content based on the language set via
set_language.

By using routes is it possible to make the page cacher think the pages
are different? Perhaps by appending the current language to the front
of the url? (eg /en/controller/action). I am in over my head as far as
routing and how to adequately do this.

What I was thinking was this:

  • default route sends user to /language/guest/welcome
  • set language redirects to /language/(current page)

Would this work, and if so, how on earth do I code it!

Sorry for the rambling email… any insight or solutions most most
welcome!

Phil

Could I perhaps use url rewriting to put a subdomain on each language?

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