Re: [Zope3-Users] Problems with internationalization

2007-07-21 Thread Dmitry Vasiliev

Jeremy Cook wrote:

Thanks Dmitry,

I can see how it should work. However I am still having trouble. My 
application is initially based on the wcsite example and is intended 
to be really not any more complex than that so I wanted to keep it 
that way. However I have probably inherited something from wcsite

that I don't fully understand. I made a small amount of progress but
I still get the following error with ++lang++test:

2007-07-19T13:18:26 ERROR SiteError http://neshamn.no/++lang++test 
Traceback (most recent call last):

[skip]

line 117, in setPreferredLanguages raise
NotCompatibleAdapterError("Adapter not compatible with " 
NotCompatibleAdapterError: Adapter not compatible with 
zope.i18n.interfaces.IModifiableBrowserLanguages has been used. 
129.177.20.93 - - [19/Jul/2007:13:18:26 +0200] "GET /++lang++test 
HTTP/1.1" 500 84 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; 
rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5"


I am not sure which adapter it is referring to and I am not sure how 
to find out either. Since my site will only be in Norwegian, I have a

 workaround which is to hard code the locale to 'no' so that dates
and such are formatted correctly, but I would still like to
understand what is wrong here.

Any ideas?


Ok, let's look briefly at the ++lang++ internals. When "++lang++" string
is encountered in the path the zope.traverse.namespace.lang's adapter
traverse() method will be called. The method then try to get an object
implementing IModifiableUserPreferredLanguages from the request and
set language with help of the setPreferredLanguages() method. The
default IModifiableUserPreferredLanguages implementation
zope.app.publisher.browser.ModifiableBrowserLanguages expects some
preparation work has been done for language overriding to work (see the 
base class for details).


Now let's look that's wrong with your code. At wcsite.languages there is
FixedLanguage adapter which prevents ModifiableBrowserLanguages adapter
to work mainly because it's always return hardcoded language. So if you
want to use ++lang++ namespace you need to modify your overrides.zcml to
remove FixedLanguage registration.

--
Dmitry Vasiliev 
http://hlabs.spb.ru

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problems with internationalization

2007-07-19 Thread Jeremy Cook

Thanks Dmitry,

I can see how it should work. However I am still having trouble. My
application is initially based on the wcsite example and is intended
to be really not any more complex than that so I wanted to keep it
that way. However I have probably inherited something from wcsite that
I don't fully understand. I made a small amount of progress but I
still get the following error with ++lang++test:

2007-07-19T13:18:26 ERROR SiteError http://neshamn.no/++lang++test
Traceback (most recent call last):
 File 
"/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/publisher/publish.py",
line 130, in publish
   obj = request.traverse(obj)
 File 
"/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/publisher/browser.py",
line 506, in traverse
   ob = super(BrowserRequest, self).traverse(obj)
 File "/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/publisher/http.py",
line 461, in traverse
   ob = super(HTTPRequest, self).traverse(obj)
 File "/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/publisher/base.py",
line 292, in traverse
   obj = publication.traverseName(self, obj, entry_name)
 File 
"/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/app/publication/publicationtraverse.py",
line 45, in traverseName
   ob2 = namespaceLookup(ns, nm, ob, request)
 File 
"/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/traversing/namespace.py",
line 109, in namespaceLookup
   return traverser.traverse(name, ())
 File 
"/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/traversing/namespace.py",
line 358, in traverse
   languages.setPreferredLanguages([name])
 File 
"/home/zope3/Zope-3.3.1/build/lib.linux-i686-2.4/zope/app/publisher/browser/__init__.py",
line 117, in setPreferredLanguages
   raise NotCompatibleAdapterError("Adapter not compatible with "
NotCompatibleAdapterError: Adapter not compatible with
zope.i18n.interfaces.IModifiableBrowserLanguages has been used.
129.177.20.93 - - [19/Jul/2007:13:18:26 +0200] "GET /++lang++test
HTTP/1.1" 500 84 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5"


I am not sure which adapter it is referring to and I am not sure how
to find out either. Since my site will only be in Norwegian, I have a
workaround which is to hard code the locale to 'no' so that dates and
such are formatted correctly, but I would still like to understand
what is wrong here.

Any ideas?

Jeremy

On 04/07/07, Dmitry Vasiliev <[EMAIL PROTECTED]> wrote:

Jeremy Cook wrote:
> Is there an example site where ++lang++whatever works? I have tried
> always with this at the beginning of the path to no avail. It would be
> nice to see it working as a confidence builder.

You can look at my site. :-) It only in Russian for now (since I've
rebuilt it from scratch about a month ago) but a few fields already
translated to English so the following URLs work as expected:

http://hlabs.spb.ru/++lang++ru
http://hlabs.spb.ru/++lang++en

--
Dmitry Vasiliev 
http://hlabs.spb.ru




--
[EMAIL PROTECTED]tlf: +47 55 58 40 65
Parallab  Bergen Centre for Computational Science
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problems with internationalization

2007-07-04 Thread Dmitry Vasiliev

Jeremy Cook wrote:
Is there an example site where ++lang++whatever works? I have tried 
always with this at the beginning of the path to no avail. It would be 
nice to see it working as a confidence builder.


You can look at my site. :-) It only in Russian for now (since I've 
rebuilt it from scratch about a month ago) but a few fields already 
translated to English so the following URLs work as expected:


http://hlabs.spb.ru/++lang++ru
http://hlabs.spb.ru/++lang++en

--
Dmitry Vasiliev 
http://hlabs.spb.ru
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problems with internationalization

2007-07-03 Thread Jeremy Cook

Is there an example site where ++lang++whatever works? I have tried always
with this at the beginning of the path to no avail. It would be nice to see
it working as a confidence builder.

Jeremy

On 03/07/07, Dmitry Vasiliev <[EMAIL PROTECTED]> wrote:


Jeremy Cook wrote:
> Using ++lang++test, ++lang++de, ++lang++no (or ++anything-else) always
> results in "a system error occurred", with an error message "Can only
> shift leading traversal names to application names". I do not understand
> this error message or what it is trying to tell me.

'++lang++' always should be at the beginning of the path.

> Also, trying to start to create the NO translation by running
> i18nextract also results in a serious error which seems non trivial to
> work around.
>
> There was an error processing C:\NLRK-Zope\lib\python\wcsite\rss.pt
> Traceback (most recent call last):
[skip]
> TALError: empty HTML tags cannot use tal:content: 'link', at line 12,
> column 3,
> in file C:\NLRK-Zope\lib\python\wcsite\rss.pt

If you use Zope 3.3 then there is the bug in zope.app.locales.extract -
all templates treated as HTML. The bug was fixed on the trunk and for
workaround you can just replace your extract.py with the extract.py from
the trunk.

And make sure the template begins with the following fragment:


http://xml.zope.org/namespaces/tal";>
...

Note '
http://hlabs.spb.ru





--
[EMAIL PROTECTED]tlf: +47 55 58 40 65
Parallab  Bergen Centre for Computational Science
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problems with internationalization

2007-07-03 Thread Dmitry Vasiliev

Jeremy Cook wrote:
Using ++lang++test, ++lang++de, ++lang++no (or ++anything-else) always 
results in "a system error occurred", with an error message "Can only 
shift leading traversal names to application names". I do not understand 
this error message or what it is trying to tell me.


'++lang++' always should be at the beginning of the path.

Also, trying to start to create the NO translation by running 
i18nextract also results in a serious error which seems non trivial to 
work around.


There was an error processing C:\NLRK-Zope\lib\python\wcsite\rss.pt
Traceback (most recent call last):

[skip]
TALError: empty HTML tags cannot use tal:content: 'link', at line 12, 
column 3,

in file C:\NLRK-Zope\lib\python\wcsite\rss.pt


If you use Zope 3.3 then there is the bug in zope.app.locales.extract - 
all templates treated as HTML. The bug was fixed on the trunk and for 
workaround you can just replace your extract.py with the extract.py from 
the trunk.


And make sure the template begins with the following fragment:


http://xml.zope.org/namespaces/tal";>
...

Note '
http://hlabs.spb.ru
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problems with internationalization

2007-06-29 Thread Christophe Combelles

Jeremy Cook a écrit :

Hi,

I have been trying to internationalize my application and add a 
Norwegian translation but am stuck. By default I am getting only English 
for things like date in news items and so on.


Using chapter 9 of the Philipp von Weitershausen book, I have tried 
various things.


Using ++lang++test, ++lang++de, ++lang++no (or ++anything-else) always 
results in "a system error occurred", with an error message "Can only 
shift leading traversal names to application names". I do not understand 
this error message or what it is trying to tell me.


I once had this message when trying to use ++lang in the middle of the url.
It should be at the begginning, like the ++debug and ++skin :
http://example.com/++lang++en/container/blahblah

Christophe



Also, trying to start to create the NO translation by running 
i18nextract also results in a serious error which seems non trivial to 
work around.


Can anyone shed any light on either of these two problems? I seem to be 
missing something fundamental here?


Jeremy

C:\NLRK-Zope>.\bin\i18nextract -p lib\python\wcsite -d wcsite -o locale
base path: 'C:\\NLRK-Zope\\'
search path: C:\NLRK-Zope\lib\python\wcsite
exclude dirs: []
domain: 'wcsite'
output file: 'C:\\NLRK-Zope\\lib\\python\\wcsite\\locale\\wcsite.pot'
There was an error processing C:\NLRK-Zope\lib\python\wcsite\rss.pt
Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\zope\app\locales\extract.py", line 
399, in

 tal_strings
p.parseFile(filename)
  File "C:\Python24\Lib\site-packages\zope\tal\htmltalparser.py", line 
122, in p

arseFile
self.parseString(data)
  File "C:\Python24\Lib\site-packages\zope\tal\htmltalparser.py", line 
128, in p

arseString
self.feed(data)
  File "C:\Python24\lib\HTMLParser.py", line 108, in feed
self.goahead(0)
  File "C:\Python24\lib\HTMLParser.py", line 148, in goahead
k = self.parse_starttag (i)
  File "C:\Python24\lib\HTMLParser.py", line 268, in parse_starttag
self.handle_starttag(tag, attrs)
  File "C:\Python24\Lib\site-packages\zope\tal\htmltalparser.py", line 
150, in h

andle_starttag
self.getpos())
TALError: empty HTML tags cannot use tal:content: 'link', at line 12, 
column 3,

in file C:\NLRK-Zope\lib\python\wcsite\rss.pt



--
[EMAIL PROTECTED] 
tlf: +47 55 58 40 65

Parallab  Bergen Centre for Computational Science




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Problems with internationalization

2007-06-29 Thread Jeremy Cook

Hi,

I have been trying to internationalize my application and add a Norwegian
translation but am stuck. By default I am getting only English for things
like date in news items and so on.

Using chapter 9 of the Philipp von Weitershausen book, I have tried various
things.

Using ++lang++test, ++lang++de, ++lang++no (or ++anything-else) always
results in "a system error occurred", with an error message "Can only shift
leading traversal names to application names". I do not understand this
error message or what it is trying to tell me.

Also, trying to start to create the NO translation by running i18nextract
also results in a serious error which seems non trivial to work around.

Can anyone shed any light on either of these two problems? I seem to be
missing something fundamental here?

Jeremy

C:\NLRK-Zope>.\bin\i18nextract -p lib\python\wcsite -d wcsite -o locale
base path: 'C:\\NLRK-Zope\\'
search path: C:\NLRK-Zope\lib\python\wcsite
exclude dirs: []
domain: 'wcsite'
output file: 'C:\\NLRK-Zope\\lib\\python\\wcsite\\locale\\wcsite.pot'
There was an error processing C:\NLRK-Zope\lib\python\wcsite\rss.pt
Traceback (most recent call last):
 File "C:\Python24\Lib\site-packages\zope\app\locales\extract.py", line
399, in
tal_strings
   p.parseFile(filename)
 File "C:\Python24\Lib\site-packages\zope\tal\htmltalparser.py", line 122,
in p
arseFile
   self.parseString(data)
 File "C:\Python24\Lib\site-packages\zope\tal\htmltalparser.py", line 128,
in p
arseString
   self.feed(data)
 File "C:\Python24\lib\HTMLParser.py", line 108, in feed
   self.goahead(0)
 File "C:\Python24\lib\HTMLParser.py", line 148, in goahead
   k = self.parse_starttag(i)
 File "C:\Python24\lib\HTMLParser.py", line 268, in parse_starttag
   self.handle_starttag(tag, attrs)
 File "C:\Python24\Lib\site-packages\zope\tal\htmltalparser.py", line 150,
in h
andle_starttag
   self.getpos())
TALError: empty HTML tags cannot use tal:content: 'link', at line 12, column
3,
in file C:\NLRK-Zope\lib\python\wcsite\rss.pt



--
[EMAIL PROTECTED]tlf: +47 55 58 40 65
Parallab  Bergen Centre for Computational Science
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users