[Zope] Re: Hmm... Localizer or Localizer

Philipp von Weitershausen philipp at weitershausen.de
Tue Sep 5 10:19:25 EDT 2006


Peter Bengtsson wrote:
> But how do you use it? I installed Five 1.2.6
> In my product's directory I created a configure.zcml that looks like this::
> <configure xmlns="http://namespaces.zope.org/zope"
>           xmlns:browser="http://namespaces.zope.org/browser"
>           xmlns:i18n="http://namespaces.zope.org/i18n"
>           package="Products.RememberYourFriends">
> 
>  <i18n:registerTranslations directory="i18n" />
> 
> </configure>
> 
> Starts without errors. My ryf-sv.po file isn't automatically compiled
> to .mo

Right. The Zope 3 machinery doesn't do that. Use msgfmt from the gettext 
utilities to compile catalogs.

You're also using PTS's non-standard directory layout. The standard 
gettext layout is somedir/LC_MESSAGES/<lang>/<domain>.mo. PTS supports 
this as well but Plone continues not to go standard here and set a bad 
example :(

> and I tried changing the HTTP_ACCEPT_LANGUAGE variable but
> still just the old default English.

HTTP_ACCEPT_LANGUAGE isn't a variable. It's an HTTP header 
(Accept-Language) that you really shouldn't modify. The request should 
be treated as read-only.

To test languages, either write your own IUserPreferredLanguages adapter 
that returns the language you want or simply configure your browser to 
send a different Accept-Language header. In Firefox, you can simply do 
this by entering "about:config" in the URL bar and changing the setting 
of the intl.accept_languages variable (e.g. to "se, en").

> Either I've missed something big and crucial or there's a bug in lack
> of errors or alerts.

You simply didn't read Five/doc/i18n.txt 
(http://codespeak.net/z3/five/i18n.html). Googling "five i18n" gives you 
that as a first hit. "RTFM" is all I can say here.

Philipp


More information about the Zope mailing list