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

2006-09-06 Thread Chris Withers

Peter Bengtsson wrote:

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.


Don't RTFM me! I've read that page and unless you have a PhD in
physics and indept experience of Zope 3 is really doesn't make a lot
of sense. Plus, I've got your cookbook at home :)


Urm, no, sorry, don't buy that. The docs are pretty good...


So, should I use PTS or not??


You do whatever you want, just don't come crying to us when you're 
screaming in pain with PTS ;-)

(of course, it may "just work" for you, in which case you're lucky)


"The default behaviour for choosing languages in Five is the one of
Zope 3: analyze the Accept-Language HTTP header and nothing more."
This is not good enough.


Knocking up a negotiator that does what you want is pretty easy. I 
already offered to send you code that does what you want...



When I send out email alerts to people in my
app, that's a wget script that kicks if off, not a Mozilla browser.


What has this got to do with anything?
(although, fwiw, url whacking is dumb, don't do that, look at Stepper 
and tricker it with cron)



I have no idea what this does or what I'm supposed to do with:



Then it's time for you to read more FM. This is all explained, from what 
I remember.



Please tell me there's a function or something that works like this::

 def index_html(self):
  uid = self._getLoggedinUID()
  wants_lang = self._getUserPreference(uid, default='en')
  setCurrentLanguage(wants_lang)
  return _("I wish it was easier")

def manage_setUserPreference(self, uid, lang):
 if lang in getAvailableLanguages():
 self._setUserPreference(uid, lang)

Where _getUserPreference() and _setUserPreference() is something I'm
 expected to write for my app.


No, it's not quite like this, but it is just as easy.

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2006-09-05 Thread Philipp von Weitershausen

Peter Bengtsson wrote:

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.


Don't RTFM me! I've read that page and unless you have a PhD in
physics and indept experience of Zope 3 is really doesn't make a lot
of sense. Plus, I've got your cookbook at home :)


You must be confusing me. I don't have a PhD in physics and I didn't 
write a cookbook. That was the other German ;).



So, should I use PTS or not??


No. I think I've answered that question before.


"The default behaviour for choosing languages in Five is the one of
Zope 3: analyze the Accept-Language HTTP header and nothing more."
This is not good enough.


Then implement your own IUserPreferredLanguages adapter. This is 
documented in my book which you may or may not have, not sure ;)



When I send out email alerts to people in my
app, that's a wget script that kicks if off, not a Mozilla browser.
Besides, what if an Englishman is using a Swedish
internetcafe-computer when on holiday; in that case I want to allow
him to manually configure his user profile on my site.


Sure. That's possible. With a custom IUserPReferredLanguages adapter.


I have no idea what this does or what I'm supposed to do with:



Nothing. The docs say that this is only for users who use PTS for 
legacy. You're not one of them.


Philipp
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2006-09-05 Thread Peter Bengtsson

On 9/5/06, Philipp von Weitershausen <[EMAIL PROTECTED]> wrote:

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::
> http://namespaces.zope.org/zope";
>   xmlns:browser="http://namespaces.zope.org/browser";
>   xmlns:i18n="http://namespaces.zope.org/i18n";
>   package="Products.RememberYourFriends">
>
>  
>
> 
>
> 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//.mo. PTS supports
this as well but Plone continues not to go standard here and set a bad
example :(


Seems awefully academic to me but if that's the standard, let's do it.
I now have a file called:
locales/LC_MESSAGES/sv/ryf.mo


> 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.


Don't RTFM me! I've read that page and unless you have a PhD in
physics and indept experience of Zope 3 is really doesn't make a lot
of sense. Plus, I've got your cookbook at home :)

So, should I use PTS or not??
"The default behaviour for choosing languages in Five is the one of
Zope 3: analyze the Accept-Language HTTP header and nothing more."
This is not good enough. When I send out email alerts to people in my
app, that's a wget script that kicks if off, not a Mozilla browser.
Besides, what if an Englishman is using a Swedish
internetcafe-computer when on holiday; in that case I want to allow
him to manually configure his user profile on my site.

I have no idea what this does or what I'm supposed to do with:


Please tell me there's a function or something that works like this::

 def index_html(self):
  uid = self._getLoggedinUID()
  wants_lang = self._getUserPreference(uid, default='en')
  setCurrentLanguage(wants_lang)
  return _("I wish it was easier")

def manage_setUserPreference(self, uid, lang):
 if lang in getAvailableLanguages():
 self._setUserPreference(uid, lang)

Where _getUserPreference() and _setUserPreference() is something I'm
expected to write for my app.

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2006-09-05 Thread Philipp von Weitershausen

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::
http://namespaces.zope.org/zope";
  xmlns:browser="http://namespaces.zope.org/browser";
  xmlns:i18n="http://namespaces.zope.org/i18n";
  package="Products.RememberYourFriends">

 



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//.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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2006-09-05 Thread Peter Bengtsson

On 9/5/06, Philipp von Weitershausen <[EMAIL PROTECTED]> wrote:

Peter Bengtsson wrote:
> What's going on here?? Which is which?
>
> http://www.ikaaro.org/localizer
> or
> http://www.j-david.net/software/localizer/
>
> They're both zope products and both with the same name.
> Perhaps the author of the "deprecated" page could put a redirect or
> something to the new one.

Do yourself a favour and do what ChrisW suggested: use Five's i18n
machinery. Comes with Zope 2.9 included. For Zope 2.8, simply install
Five 1.2. It's a no-brainer (isntalling Five 1.2).



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::
http://namespaces.zope.org/zope";
  xmlns:browser="http://namespaces.zope.org/browser";
  xmlns:i18n="http://namespaces.zope.org/i18n";
  package="Products.RememberYourFriends">

 



Starts without errors. My ryf-sv.po file isn't automatically compiled
to .mo and I tried changing the HTTP_ACCEPT_LANGUAGE variable but
still just the old default English.

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

Pulling my hair :(


Philipp

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )




--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2006-09-05 Thread Philipp von Weitershausen

Peter Bengtsson wrote:

What's going on here?? Which is which?

http://www.ikaaro.org/localizer
or
http://www.j-david.net/software/localizer/

They're both zope products and both with the same name.
Perhaps the author of the "deprecated" page could put a redirect or
something to the new one.


Do yourself a favour and do what ChrisW suggested: use Five's i18n 
machinery. Comes with Zope 2.9 included. For Zope 2.8, simply install 
Five 1.2. It's a no-brainer (isntalling Five 1.2).


Philipp

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )