<configure
   xmlns="http://namespaces.zope.org/zope">

  <!-- Setup language negotiation -->
  <utility
      provides="zope.i18n.interfaces.INegotiator"
      component="zope.i18n.negotiator.negotiator"
      />

  <adapter factory="zope.app.publisher.browser.ModifiableBrowserLanguages"
      for="zope.publisher.interfaces.http.IHTTPRequest"
      provides="zope.i18n.interfaces.IModifiableUserPreferredLanguages"
      />

  <class class="zope.publisher.http.HTTPRequest">
      <implements interface="zope.app.annotation.IAttributeAnnotatable" />
  </class>

  <!-- Setup charset negotiation -->
  <adapter factory="zope.publisher.http.HTTPCharsets"
      for="zope.publisher.interfaces.http.IHTTPRequest"
      provides="zope.i18n.interfaces.IUserPreferredCharsets"
      />

  <!-- Register the Translation Domain as a content object -->
  <localUtility class=".translationdomain.TranslationDomain">
    <factory
         id="zope.app.i18n.TranslationDomain"
         />
    <allow interface="zope.i18n.interfaces.ITranslationDomain"
        />
    <require permission="zope.ManageSite"
        interface="zope.app.container.interfaces.IContainer"
        />
    <require permission="zope.ManageSite"
        interface=".interfaces.IWriteTranslationDomain"
        />
    <require permission="zope.ManageSite"
        interface=".interfaces.ISyncTranslationDomain"
        />
  </localUtility>

  <subscriber
       for=".interfaces.ILocalTranslationDomain
            ..component.interfaces.registration.IRegistrationActivatedEvent"
       handler=".translationdomain.setDomainOnActivation"
       />

  <subscriber
       for=".interfaces.ILocalTranslationDomain
            ..component.interfaces.registration.IRegistrationDeactivatedEvent"
       handler=".translationdomain.unsetDomainOnDeactivation"
       />

  <!-- Setup Message Catalogs -->
  <content class=".messagecatalog.MessageCatalog">
    <factory id="zope.app.MessageCatalog" />
    <implements
        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />

    <require permission="zope.View"
        interface="zope.i18n.interfaces.IMessageCatalog" />
    <require permission="zope.ManageSite"
        attributes="setMessage getMessageIds" />
  </content>


  <!-- Setup Export and Import Filters -->
  <adapter
      factory=".filters.GettextExportFilter"
      for=".interfaces.ILocalTranslationDomain"
      provides="zope.i18n.interfaces.IMessageExportFilter"
      />

  <adapter
      factory=".filters.GettextImportFilter"
      for=".interfaces.ILocalTranslationDomain"
      provides="zope.i18n.interfaces.IMessageImportFilter"
      />

  <include file="locales.zcml" />
  <include package=".xmlrpc" />
  <include package=".browser" />

</configure>
