Re: z3c.form missing *.mo files?

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <CAJ5sox6+YMvoFqocDe-efb8E+Ov+=CoSFbr8q56EfL9ruE=OHA@mail.gmail.com>
On Tue, Jul 12, 2011 at 3:07 PM, Michael Howitz <[email protected]> wrote:
> To get the .mo files compiled at runtime you need the following variables in os.environ:
>
> 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 zope.i18n.config.

The above is one approach I ported to zope.i18n from Plone's
PlacelessTranslationService. I think it's only documented in
Plone-level documentation.

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
folder/locales/en/LC_MESSAGES/domain.po

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.

Hanno
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.