Acquisition trouble I am setting up a bilingual website (english/german). I followed the instructions in http://www.zope.org/Members/Hoekstra/ChangingZopeContexts which I modified a little, because I don't have more than 2 languages on this site. I created the following structure: / navigation standard_html_header standard_html_footer index_html de/ content about/ order/ ... en/ content about/ order/ ... home/ index_html The logic is this: By entering the website, /home/index_html is called. It looks at the browser language and decides, whether it is german (->de) or anything else (->en). This is /home/index_html: ---------- /home/index_html ---------- <dtml-var standard_html_header> <dtml-if "REQUEST.HTTP_ACCEPT_LANGUAGE=='de'"> <dtml-var de> <dtml-else> <dtml-var en> </dtml-if> <dtml-var standard_html_footer> ---------------------------------------- So this should point at /en, if the browser language is different than german (language selection works perfect in this case). The content of /de are some subfolders without an index_html, so the index_html of / should be used. This is /index_html: ---------- /index_html ---------- <dtml-var standard_html_header> <dtml-var navigation> <dtml-if content> <dtml-var content> </dtml-if> <dtml-var standard_html_footer> ---------------------------------------- ---------- /navigation ---------- <a href="<dtml-var about>">about</a> | <a href="<dtml-var performance>">performance</a> | <a href="<dtml-var security>">security</a> | <a href="<dtml-var prices>">prices</a> | <a href="<dtml-var support>">support</a> | <a href="<dtml-var order>">order</a> | <a href="/en/"><dtml-var english></a> | -->icon <a href="/de/"><dtml-var deutsch></a> | -->icon ---------------------------------------- So if the browser language is detected, and points to /de or /en, /index_html should be used, to display an object called 'content' (if it exists) and the /navigation object should be included. If the user decides to select another language, he/she can click on the appropriate language link (de/en). On this level, the browser language detection should no more be active. But what I get is this traceback, which seems to originate from /navigation: Traceback (innermost last): File C:\ZOPE\lib\python\ZPublisher\Publish.py, line 150, in publish_module File C:\ZOPE\lib\python\ZPublisher\Publish.py, line 114, in publish File C:\ZOPE\lib\python\Zope\__init__.py, line 158, in zpublisher_exception_hook (Object: zopehosting) File C:\ZOPE\lib\python\ZPublisher\Publish.py, line 98, in publish File C:\ZOPE\lib\python\ZPublisher\mapply.py, line 88, in mapply (Object: index_html) File C:\ZOPE\lib\python\ZPublisher\Publish.py, line 39, in call_object (Object: index_html) File C:\ZOPE\lib\python\OFS\DTMLMethod.py, line 127, in __call__ (Object: index_html) File C:\ZOPE\lib\python\DocumentTemplate\DT_String.py, line 473, in __call__ (Object: index_html) File C:\ZOPE\lib\python\OFS\DTMLMethod.py, line 120, in __call__ (Object: standard_html_header) File C:\ZOPE\lib\python\DocumentTemplate\DT_String.py, line 473, in __call__ (Object: standard_html_header) File C:\ZOPE\lib\python\OFS\DTMLMethod.py, line 120, in __call__ (Object: navigation) File C:\ZOPE\lib\python\DocumentTemplate\DT_String.py, line 473, in __call__ (Object: navigation) KeyError: about So there seems to be a problem with the first called navigation object (about). This is a subdirectory of /de and /en. What did I miss? _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com
Stephan Goeldi writes:
... misconception about "dtml-var" and "index_html" ...
When "f" is a folder, then <dtml-var f> does not render "f.index_html". The "index_html" magic is a feature (solely) of ZPublisher. It is only effective during traversal. The best solution is to redirect into the language specific folder. An alternative is to use '<dtml-var "_.render(f.index_html)">'. Note, that in this case, relative URL from may get wrong. Dieter
At 29.03.2002 13:23 +0100, Dieter Maurer wrote:
Stephan Goeldi writes:
... misconception about "dtml-var" and "index_html" ...
When "f" is a folder, then
<dtml-var f>
does not render "f.index_html".
The "index_html" magic is a feature (solely) of ZPublisher. It is only effective during traversal.
The best solution is to redirect into the language specific folder.
An alternative is to use '<dtml-var "_.render(f.index_html)">'. Note, that in this case, relative URL from may get wrong.
You *can* do the above with CallableFolders http://www.zope.org/Members/shh/CallableFolder grz Stefan -- BLOWFISH n. - Preference for beef
I am setting up a bilingual website (english/german). I followed the instructions in
Did you try to use the Localizer product? I did not read through all of your message, but I just successfully deployed bilingual site using Localizer, and boy it rocks :-) If you use Localizer you do not need to worry about context changing. It happens transparently. It's painless. -- Milos Prudek
participants (4)
-
Dieter Maurer -
Milos Prudek -
Stefan H. Holek -
Stephan Goeldi