[Zope] Two Languages - checking if [default_en-Method] exists
Tino Wildenhain
tino@wildenhain.de
Mon, 28 May 2001 11:04:40 +0200
Hi Martin,
there is some work under its way for content-negotiation.
However, if you just want to transparent provide localized
pages, you might try out my VaryTag (see http://www.zope.org/Members/tino/ )
Its a bit ugly in the respect it needs to spawn all language blocks
in one document.
Alternatively, you can use something like that in an index_html method:
<dtml-if "'de' in objectIDs('DTML Method')">
<dtml-if "'en' in objectIDs('DTML Method')">
<dtml-vary lang="de">
<dtml-var de>
<dtml-vary lang="en">
<dtml-var en>
<dtml-else>
<dtml-var de>
</dtml-if en>
<dtml-else>
<dtml-var en>
</dtml-if en>
Providing you have at least one of two DTML-Methods with ids 'de' and
'en' in your folder
Note: the second "vary" is not a new tag but a block continuation
(like elif to if). You can only use one vary-tag in a published
object.
HTH
Tino Wildenhain
--On Montag, 28. Mai 2001 09:17 +0200 Martin Stoetzel
<martin.stoetzel@gmx.net> wrote:
> Hi,
>
> I am working on a homepage with two languages, German and English
> (whereas German is the default language, sorry guys ;)
>
> I have a button to change the language. By clicking this 'language'-button
> another index_html is loaded, the menu and the content of the main-cell
> changes its language.
>
> The problem is that I don't have the English translation of all pages and
> therefore want to check if a method "default_en" exists in the folder. If
> not, show the "default"-method (which is German)
> It is not that easy because I need to check the exact (absolute) method
> location because a folder may not have the default_en but inherits from
> its Parents.
>
> This method-exist check is the problem.
> I have read former mails and tried the "hasattr" function but I could not
> make it run.
>
> Thanks for any input.
>
> Martin
>
> --
> Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
> http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )