On Tue, Jul 12, 2011 at 3:07 PM, Michael Howitz <m...@gocept.com> wrote:
> To get the .mo files compiled at runtime you need the following variables in
> os.environ['zope_i18n_compile_mo_files'] = 'True'
> os.environ['zope_i18n_allowed_languages'] = 'de,en'
> (You might replace 'de,en' with the languages you need :)
> Additionally you need to depend on the package 'python-gettext' which
> contains the compiler.
> Sadly this is only documented in the source code of zope.i18n.compile and and
The above is one approach I ported to zope.i18n from Plone's
PlacelessTranslationService. I think it's only documented in
You can also integrate the compilation into your build process and use
the gettext tools to do this:
msgfmt --no-hash -o folder/locales/en/LC_MESSAGES/domain.mo
The --no-hash isn't required, but makes the files a bit smaller by
removing some data structures not used by Python's gettext
implementation. It also makes sure the files are identical to those
compiled with python-gettext.
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -