[Zope3-dev] Job Board Example
Guido van Rossum
guido@python.org
Mon, 17 Jun 2002 23:01:13 -0400
> Indeed! I love internationalization even more as a monolingual
> American. :)
Well, Google has a translation into "Elmer Fudd". See
http://services.google.com/tcbin/tc.py?cmd=status -- it's a Python
script, although a buggy one -- 103% complete?!?!
> GvR> You don't need the file='configure.zcml' part since that's
> GvR> the default value. :-)
>
> Ah, cut-n-paste from products.zcml.in, but we probably don't need that
> attribute in that file either (besides, the value is incorrect now;
> I'll remove it).
Too late, I already removed it. :-)
> Ah, ok, comment out one of the zmi:factory directives and they'll both
> work.
Yup.
> For now, the best steps are
>
> - clone locale/en/LC_MESSAGES/jobboard.po to
> locale/xx/LC_MESSAGES/jobboard.po where `xx' is your new language
> code.
Did that. Tip: don't use cp -a on the whole 'en' subdirectory. :-(
> - Edit your new jobboard.po to change the msgstr entries to the
> translation in your language (po-mode in Emacs is really handy here;
> let me know if you need a copy -- I don't think it comes with XEmacs
> by default).
Done. The example is so small it's not really needed. However for
many translations with similar-sounding English versions I wasn't sure
what they stand for (and I spent hours today hacking the code :-).
> - Use msgfmt to generate the jobboard.mo file from the newly
> translated jobboard.po file.
That was the only clue I was really missing (I found it minutes before
your email arrived :-).
> - Restart Zope.
>
> GvR> (3) I think I've hit a bug in the i18n code. In the i18n
> GvR> version, try to submit a job. When I click on the preview
> GvR> button, I get a traceback saying "TypeError: coercing to
> GvR> Unicode: need string or buffer, NoneType found", at line 104
> GvR> in SimpleTranslationService (in interpolate).
>
> I get a different error using the English translation. I get through
> Preview but when I hit Submit I get:
Hmm, I think I needed a cvs update.
> -------------------- snip snip --------------------
> AttributeError
>
> Traceback (innermost last):
>
> * Module Zope.Publisher.Publish, line 39, in publish
> * Module Zope.App.ZopePublication.ZopePublication, line 117, in callObject
> * Module Zope.Publisher.mapply, line 106, in mapply
> __traceback_info__: <security proxied __builtin__.instance method instance at 0x861efec>
> * Module ZopeProducts.JobBoardI18n.JobCreateView, line 18, in create
> * Module Zope.PageTemplate.PageTemplate, line 95, in __call__
> * Module Zope.PageTemplate.PageTemplate, line 113, in pt_render
> Warning: Macro expansion failed
> Warning: exceptions.AttributeError: 'Context' object has no attribute 'translate'
> * Module Zope.TAL.TALInterpreter, line 164, in __call__
> * Module Zope.TAL.TALInterpreter, line 203, in interpret
> * Module Zope.TAL.TALInterpreter, line 529, in do_insertTranslation
> * Module Zope.TAL.TALInterpreter, line 609, in translate
>
> AttributeError: 'Context' object has no attribute 'translate'
> -------------------- snip snip --------------------
I now get this too. I'm clueless in this part of Zope, so I'll leave
it to you & Stephan.
--Guido van Rossum (home page: http://www.python.org/~guido/)