[Zope] overrides.zcml and localization in Zope 2.9

Doyon, Jean-Francois Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Tue Jun 6 11:59:11 EDT 2006


Hello,

I'm trying to override Zope's localization mechanism with my own, as
documented here:

http://codespeak.net/z3/five/i18n.html

And am not having any luck.

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

<i18n:registerTranslations directory="locales" />

</configure>

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

<adapter
    for="zope.publisher.interfaces.http.IHTTPRequest"
    provides="zope.i18n.interfaces.IUserPreferredLanguages"
    factory=".i18n.URLLanguages"
    />

</configure>

from zope.i18n.interfaces import IUserPreferredLanguages
from zope.interface import implements

class URLLanguages(object):
    
    implements(IUserPreferredLanguages)

    def __init__(self, context):
        self.context = context

    def getPreferredLanguages(self):
        return ['fr']

As best I can tell, the method never gets called, I've added print and raise
statements and so on and yet nothing ever seems to happen.

With the above example HTTP_ACCEPT_LANGUAGE still always ends up being en-us
...

Also, locales/fr.mo exists.

What am I missing here?

Thanks,

Jean-François Doyon
Internet Service Development and Systems Support / Spécialiste de
dèveloppements internet et soutien technique
Canada Centre for Remote Sensing/Centre Canadien de télédétection
Natural Resources Canada/Ressources Naturelles Canada
http://atlas.gc.ca
Tel./Tél.: (613) 992-4902
Fax: (613) 947-2410


More information about the Zope mailing list