Re: [Zope-dev] z3c.form missing *.mo files?
Am 12.07.2011 um 18:19 schrieb Marius Gedminas: > On Tue, Jul 12, 2011 at 03:07:47PM +0200, Michael Howitz wrote: >> There where never .mo files in z3c.form's sdist. > > That appears not to be the case: http://pypi.python.org/pypi/z3c.form/2.4.3 > has a source distribution (z3c.form-2.4.3.zip) which contains a few *.mo > files inside. Then I have to correct my statement: There was at least one z3c.form sdist released in the past which did not contain .mo files: The one I used in my last project using z3c.form. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh & co. kg · Forsterstraße 29 · 06112 Halle (Saale) · Germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
Hi, You have http://pypi.python.org/pypi/zest.pocompile which work with zest.releaser to compile mo before doing the sdist. Vincent Fretin ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
On Tue, Jul 12, 2011 at 07:26:59PM +0300, Marius Gedminas wrote: > On Tue, Jul 12, 2011 at 07:19:07PM +0300, Marius Gedminas wrote: > > And then what? Surely just having python-gettext installed and a couple > > of environment variables defined is not enough to magically produce .mo > > files Yes, actually it does ;) But the compiling happens during run-time when you start up the server. Neither the sdist nor binary egg need to contain the .mo files. I can't remember if it actually writes those files out to the filesystem. > -- I would also need to run some Python script somewhere, > > presumably. Is it z3c.form's bin/pocompile? > > So I tried > > cd ~/src/z3c.form > bin/pocompile > python setup.py sdist > > and found that my dist/z3c.form-2.4.5dev.tar.gz now contains a .mo next > to each .po in src/z3c/form/locales/. > > So, should I release z3c.form 2.4.5 with the .mo's? > > I would also like to add a RELEASING.txt with something like this > > If you're making a public z3c.form release to the Python Package > Index, don't forget to generate .mo files with:: > > bin/pocompile > > before you do the usual ``python setup.py sdist register upload`` > step. > > Ideally, I'd like ``python setup.py sdist`` itself to check for up-to-date > .mo's and either regenerate them automatically, or at least complain > loudly. I normally use a setuptools plugin I wrote for this: http://pypi.python.org/pypi/van.potomo The chicken and egg issue means it's probably worse than what you wrote. /me hoping that distutils2 will take care of these things. -- Brian Sutherland ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
On Tue, Jul 12, 2011 at 07:19:07PM +0300, Marius Gedminas wrote: > And then what? Surely just having python-gettext installed and a couple > of environment variables defined is not enough to magically produce .mo > files -- I would also need to run some Python script somewhere, > presumably. Is it z3c.form's bin/pocompile? So I tried cd ~/src/z3c.form bin/pocompile python setup.py sdist and found that my dist/z3c.form-2.4.5dev.tar.gz now contains a .mo next to each .po in src/z3c/form/locales/. So, should I release z3c.form 2.4.5 with the .mo's? I would also like to add a RELEASING.txt with something like this If you're making a public z3c.form release to the Python Package Index, don't forget to generate .mo files with:: bin/pocompile before you do the usual ``python setup.py sdist register upload`` step. Ideally, I'd like ``python setup.py sdist`` itself to check for up-to-date .mo's and either regenerate them automatically, or at least complain loudly. Awaiting feedback, Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
On Tue, Jul 12, 2011 at 03:07:47PM +0200, Michael Howitz wrote: > There where never .mo files in z3c.form's sdist. That appears not to be the case: http://pypi.python.org/pypi/z3c.form/2.4.3 has a source distribution (z3c.form-2.4.3.zip) which contains a few *.mo files inside. There's also a MANIFEST.in with global-include *.mo in it. > 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. And then what? Surely just having python-gettext installed and a couple of environment variables defined is not enough to magically produce .mo files -- I would also need to run some Python script somewhere, presumably. Is it z3c.form's bin/pocompile? Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
On Tue, Jul 12, 2011 at 3:07 PM, Michael Howitz 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 - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
Am 12.07.2011 um 13:39 schrieb Adam GROSZER: > On Tue, 12 Jul 2011 14:36:12 +0300 you wrote: >> >> On Tue, Jul 12, 2011 at 01:09:14PM +0200, Adam GROSZER wrote: >>> What's the paxis, should gettext mo files be included in the eggs? >> >> I've no idea what "paxis" is, nor whether there should be .mo files in >> z3c.form's sdist. >> >> I've made a z3c.form bugfix release yesterday using zest.releaser from a >> fresh svn checkout. If there are additional steps required for making a >> release, and my lack of knowledge of those renders the 2.4.4 sdist >> somehow incomplete, I will gladly perform release a fixed 2.4.5 as soon >> as someone tells me what those extra steps are. >> >> Regards, >> Marius Gedminas > > No worries, huh, I don't want to blame you... > > I'd say the mo files should be available in the sdist, otherwise you > don't really have a chance to compile those. There where never .mo files in z3c.form's sdist. (I think because .mo file are compiled files like .pyc files which are not included as well.) 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. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh & co. kg · Forsterstraße 29 · 06112 Halle (Saale) · Germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
On Tue, 12 Jul 2011 14:36:12 +0300 you wrote: > > On Tue, Jul 12, 2011 at 01:09:14PM +0200, Adam GROSZER wrote: >> What's the paxis, should gettext mo files be included in the eggs? > > I've no idea what "paxis" is, nor whether there should be .mo files in > z3c.form's sdist. > > I've made a z3c.form bugfix release yesterday using zest.releaser from a > fresh svn checkout. If there are additional steps required for making a > release, and my lack of knowledge of those renders the 2.4.4 sdist > somehow incomplete, I will gladly perform release a fixed 2.4.5 as soon > as someone tells me what those extra steps are. > > Regards, > Marius Gedminas No worries, huh, I don't want to blame you... I'd say the mo files should be available in the sdist, otherwise you don't really have a chance to compile those. -- Best regards, Adam GROSZER -- Quote of the day: To believe only possibilities is not faith, but mere philosophy. - Sir Thomas Browne ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )
Re: [Zope-dev] z3c.form missing *.mo files?
On Tue, Jul 12, 2011 at 01:09:14PM +0200, Adam GROSZER wrote: > What's the paxis, should gettext mo files be included in the eggs? I've no idea what "paxis" is, nor whether there should be .mo files in z3c.form's sdist. I've made a z3c.form bugfix release yesterday using zest.releaser from a fresh svn checkout. If there are additional steps required for making a release, and my lack of knowledge of those renders the 2.4.4 sdist somehow incomplete, I will gladly perform release a fixed 2.4.5 as soon as someone tells me what those extra steps are. Regards, Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org 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 )