Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

PO to MO build time compiler

Project description

Purpose

This package integrates pure-python gettext translation compilation (msgfmt) into the setup.py “build” and “develop” commands.

These commands are extended so that every “data file” identified by setuptools with the .po extension is compiled to a .mo file in the same directory as the .po file.

This integrates very well if you use z3c.recipe.i18n (and hopefully others as well) to manage .po files.

Usage

You need to override the “build” and “develop” commands in your setup.py, for example:

from setuptools import setup, find_packages
from van.potomo import develop, build

setup(
    name = "HelloWorld",
    cmdclass={'build': build,
              'develop': develop},
    setup_requires=["van.potomo"],
    version = "0.1",
    packages = find_packages(),
)

Why

This package exists because the author believes that:

  • Compiled translations should not be stored under revision control, they are not source
  • Compiled translations should not be distributed in tarballs, they are not source
  • Compiled translations should not be “lazily compiled” unless you take into account that filesystems on production machines are often read-only.
  • The process of compiling translations should not require an extra step/options during the build/install or build/develop cycle.

The options available at the time offered all of this:

  • Babel: Not integrated into the “build” distutils command.
  • cc.gettext: Depends on buildout, not useful for deployments by other means.
  • zope.i18n lazy compilation: Very nice for development, but not on some production environments.

Caveats

van.potomo makes your setup.py depend on van.potomo. But outside tools cannot tell this because they need to run the setup.py to figure out the dependencies.

Basically this means your developers/users will need to install van.potomo manually before anything else. If anyone knows a robust/good way to get around this limitation, please let the author know.

Changes

2.1 (2013-08-23)

  • run egg_info before develop to make sure SOURCES.txt exists and is up to date

2.0 (2013-08-15)

  • Conform to Zope repository policy.
  • Support Python 3
  • Fix issue where recently deleted files could cause an exception if they were still in SOURCES.txt

1.0.0 (2009-03-10)

  • Initial Release

Project details


Release history Release notifications

This version
History Node

2.1

History Node

2.0

History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
van.potomo-2.1.tar.gz (4.8 kB) Copy SHA256 hash SHA256 Source None Aug 23, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page