I only have a few internationalized pages, but I'm more than half-way
happy with a very simple approach:

1) an External Method "preferred_lang", which takes a list of possible
   languages as argument, and returns the language from that list that
   has the highest ranking in HTTP_ACCEPT_LANGUAGE. If there is no
   hit, it returns the first language in the list.
   ------------------------------------
   import string

   def preferred_lang(self,langs):
      for lang in map(string.strip,string.split(self.HTTP_ACCEPT_LANGUAGE,',')):
        if lang in langs:
          return lang
      return langs[0]
   -------------------------------------
   This External Method is available as "PreferredLanguage" on the
   root folder.

2) In each internationalized page, I call the External Method with a
   list of the available languages (it is not the same for all
   pages), and then select the contents based on the result.
   ------------------------------------
   <dtml-var standard_html_header>
   <dtml-call "REQUEST.set('lang',PreferredLanguage(REQUEST,['en','nl']))">

   <dtml-if "lang=='nl'">
   <H2>De Hooft Familie Webdienst</H2>
   <dtml-else>
   <H2>The Hooft Family Web</H2>
   </dtml-if>
   ....etc....
   -------------------------------------

One advantage of this approach is that it keeps the different versions
together (making updates to the information easy to keep consistent).
One disadvantage of this approach is that it keeps the different
versions together (making it difficult to appoint different people to
maintaining the different languages), and another disadvantage is that
it clutters up the dtml source.

Suggestions for improvements always welcome.

Regards,

Rob Hooft

-- 
=====   [EMAIL PROTECTED]          http://www.hooft.net/people/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to