[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n - IUserPreferredCharsets.py:1.1 i18n.zcml:1.7

Stephan Richter srichter@cbu.edu
Fri, 14 Jun 2002 04:56:59 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/I18n
In directory cvs.zope.org:/tmp/cvs-serv23607/Zope/I18n

Modified Files:
	i18n.zcml 
Added Files:
	IUserPreferredCharsets.py 
Log Message:
Similar to the Language Negotiator I created a Charset negotiator, which 
should help us with defining an output charset for the browser.


=== Added File Zope3/lib/python/Zope/I18n/IUserPreferredCharsets.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""See IUserPreferredCharsets.

$Id: IUserPreferredCharsets.py,v 1.1 2002/06/14 08:56:29 srichter Exp $
"""

from Interface import Interface

class IUserPreferredCharsets(Interface):
    """This interface provides charset negotiation based on user preferences.
    """
  
    def getPreferredCharsets():
        """Return a sequence of user preferred charsets. Note that the order
           should describe the order of preference. Therefore the first
           character set in the list is the most preferred one.
        """


=== Zope3/lib/python/Zope/I18n/i18n.zcml 1.6 => 1.7 ===
 >
 
+<!-- Setup language negotiation -->
 <serviceType
       id="LanguageNegotiation" 
       interface=".INegotiator." />
@@ -17,6 +18,13 @@
 <adapter factory="Zope.Publisher.Browser.BrowserLanguages."
          for="Zope.Publisher.Browser.IBrowserRequest."
          provides="Zope.I18n.IUserPreferredLanguages."
+         />
+
+
+<!-- Setup charset negotiation -->
+<adapter factory="Zope.Publisher.Browser.BrowserCharsets."
+         for="Zope.Publisher.Browser.IBrowserRequest."
+         provides="Zope.I18n.IUserPreferredCharsets."
          />