[Zope] URL rewrite + cache question.
Tue, 2 Oct 2001 16:40:25 +0200 (CEST)
Hi people, I have a quite complex URL rewriting question,
I don't even know if it can be done, I'll *really*
appreciate any opinion on this.
I'm building some multilingual structure, I have a
"Translate" product, that works like this:
if I visit http://zopesite/a/b/c and the language
is "en" it tries to get content (text and images)
from /a/b/c/en, where en is an instance of this
"translate" product. If there no such dir it gets the
content from /a/b/c/
This way the mantainer can just add a "translate"
wherever he wants to translate that folder content,
and you can even translate "images", and don't have
to rebuild the whole tree structure, just translate
what you want.
the language is passed via cookies and the first time
is called with ?lang=en, GET syntax.
The problem is that if I cache the pages there's no
way to distinguish a/b/c in english from a/b/c in
french, and the wrong pages come up.
So I would like to add the language to the url (and
would look nicer too).
solution 1) use addresses like http://zopesite/a/b/c/en
I should check if the meta_type=="translate" and call
the previous dir with the correct language
but if there's no "fr" translation for this folder, how
can fall back to http://zopesite/a/b/c/ ?
I could create some base /fr/ directory that would
be seen via acquisisiton, but how can I stop the
user from creating some fr/ folder that masks the
solution 2) addresses like http://zopesite/en/a/b/c
http://zopesite/fr/a/b/c, but I want to maintain
my structure where the translation goes inside
the "last" folder, not double the site structure.
so the rewriting would be
http://zopesite/en/a/b/c -> http://zopesite/a/b/c?lang=en
or the language could be passed inside REQUEST.
the fact is that there are no a/b/c inside en/, it
would be just an url trick. I can't do this with
apache because I have to check that en/ is a real
this solution would be the best because the user
could still create its own en,fr,es,... folders.
Ok, maybe I wrote too much :-(, sorry about that,
just wanted to make the point clear.
Thanks in advance!!!