[Zope] Newbie question: dtml or python comand requested

E. Seifert e.seifert@gmx.net
Sat, 26 May 2001 12:08:10 +0200


Hi fernando,

>i recently constructed a navigation bar with zope. now i would like to
>include a functionality to switch languages. when clicking on a "spanish"
>button, the folder ids that are displayed shall be replaced by the values
of
>a spanish attribute - the corresponding spanish description for the link.
>depending on whether spanish content exists for this link either a spanish
>or english default document shall be displayed in the right part of the
>window. for carrying out this if-query i need to look dynamically - always
>when the button is clicked - into the folder level, one level below the
>context and search the "spanish_default". so, please, what is the command
>(dtml or python) for "starting a search" for a document that is situated in
>a folder (which is not known by name, because it changes) one level below
>the current context folder. (like  <dtml-if ../spanish_default> do...    ).

There are several Zope products for internationalization/localization:
Localizer, ZBabel, vary tag, etc.
I think this is what you are searching for and its less expensive to use
them than to code everything by yourself.
You can get Localizer from http://sourceforge.net/projects/lleu

If you nevertheless don't want to use an external Product:
To check the existance of an object in the current folder whose name is
stored in the string objName use:
<dtml-if "_.getitem(objName)">
To check other folders you could either use getitem and the dtml-with tag or
the following:
<dtml-if "_.hasattr(folderObj,objName)">

Bye,
Eric