Plone, Zope and the PlacelessTranslationService
August 2018
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
About
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments
Recent Trackbacks
Categories
OpenBSD (9 items)
BSD (0 items)
FreeBSD (19 items)
Linux (3 items)
Security (3 items)
Python (22 items)
Zope (13 items)
Daily (144 items)
e-shell (9 items)
Hacks (14 items)
PostgreSQL (3 items)
OSX (8 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (1 items)
Django (24 items)
Music (12 items)
Plone (7 items)
Varnish (0 items)
Lugo (2 items)
Sendmail (0 items)
europython (7 items)
Cherokee (1 items)
self (1 items)
Nature (1 items)
Hiking (0 items)
uwsgi (0 items)
nginx (0 items)
cycling (10 items)
Networking (1 items)
DNS (0 items)
Archives

Syndicate this site (XML)

RSS/RDF 0.91

26 marzo
2008

Plone, Zope and the PlacelessTranslationService

or when you feel yourself lost in a vast ocean...
[Zope] 

Last two days I've been trying to figure out why PloneGazette didn't work properly in a Plone site I've been working on lately. Plone version was 3.0.5, on top of Zope 2.10.5, everything running (almost) fine, but that PloneGazette product didn't want to show up in my site default language (spanish).

At first, I noticed some ugly error messages in Zope's event.log:

2008-02-12T14:10:25 ERROR Zope.SiteErrorLog http://prunus:8080/Control_Panel/TranslationService/PloneGazette.i18n-plonegazette_es.po/index_html
Traceback (innermost last):
  Module ZPublisher.Publish, line 122, in publish
  Module ZServer.HTTPResponse, line 262, in setBody
  Module ZPublisher.HTTPResponse, line 324, in setBody
  Module ZPublisher.HTTPResponse, line 476, in _encode_unicode
UnicodeEncodeError: 'latin-1' codec can't encode character u'\ufffd' in position 4192: ordinal not in range(256)

Weird, seems like there was some problem with the translation file for spanish. After opened up the ZMI in a web browser, I took a look over the PlacelessTranslationService just to find out that the special spanish characters (accent vocals, ñ, etc) were screwed up.

After a while, I noticed that the translation file set up its charset as iso-8859-1:

"Content-Type: text/plain; charset=iso-8859-1\n"

While the file itself was encoded as UTF-8:

[prunus] /usr/local/www/zope2105/Products/PloneGazette/i18n> file plonegazette_es.po
plonegazette_es.po: UTF-8 Unicode PO (gettext message catalogue) text, with very long lines
[prunus] /usr/local/www/zope2105/Products/PloneGazette/i18n>

Well, easy solution to an ugly problem, just setting up the right encoding solved part of the problem:

"Content-Type: text/plain; charset=utf-8\n"

After changed the .po file, I just reload the catalog for it in the PlacelessTranslationService and the event.log error went away.

NICE! (I thought), I just tried again the Plone site just to find out that the PloneGazette messages were still in the default language (english). WTF...

Then I noticed that the site was as its default language spanish(spain), that is, es_es, while the .po file for the spanish translation was primary for es and it was the fallback for those:

"X-Is-Fallback-For: es-ar es-bo es-cl es-co es-cr es-do es-ec es-sv es-gt es-hn es-mx es-ni es-pa es-py es-pe es-pr es-us es-uy es-ve\n"

Exactly! no es_es in there!

So, two easy solutions:

  • Change the default language for the site to es
  • Add es_es to the list X-Is-Fallback-For

And then the problem was solved (well, sort of, cause the .po file wasn't entirely translated anyway).

Posted by wu at 13:31 | Comments (0) | Trackbacks (0)
<< Comments are back! | Main | Speedo most hidden secret >>
Comments
Re: Plone, Zope and the PlacelessTranslationService

Thanks for your work upfront. I underwent a similar problem that the language file for PloneGazette was not completely translated for unicode de. So I edited the po-file via vim-editor and the translation fell back to standard English.

While fiddling around I noticed the following:

1. Before editing the file it says:
file plonegazette_de.po
plonegazette_de.po: UTF-8 Unicode PO (gettext message catalogue) text, with very long lines


2. After editing with vim and introducing special characters it says:
file plonegazette_de.po
plonegazette_de.po: Non-ISO extended-ASCII PO (gettext message catalogue) text, with very long lines


I assumed that due to the fact that the text file was not unicode any longer internal checking fell back to system default English. Thus I edited the original file with the pure unicode editor mined which resulted in:

file plonegazette_de.po
plonegazette_de.po: UTF-8 Unicode PO (gettext message catalogue) text, with very long lines


Thus I could complete translation to German without any further hustle and the local language is being shown flawlessly.

Best wishes

Sebastian

Posted by: Sebastian at julio 17,2008 10:36
Trackbacks
Please send trackback to:http://blog.e-shell.org/51/tbping
There are no trackbacks.
Post a comment