This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description


Current version: 0.5

This script automates the creation and maintenance of multiple language catalogs across a django project. The current language maintenance tool included in django does not manage multiple catalogs sparsed through the django project tree, this script ends that. Using this script with transifex-client is a very good option.

How to install

To install this script you must copy it inside your project root (in the same directory as or you can make a “scripts” directory inside your project root and copy the script there.

Configuring django to use the script

Django has (in my opinion) the bad habit of including all the applications in the same variable: INSTALLED_APPS, that is not a good thing, because it doesn’t isolate the user applications.

What you need to do is just that, isolate your applications from the django ones, making another variable, for example MYPROJECT_APPS and then unite them to the django ones in INSTALLED_APPS. In this example case, the project applications have been separated into three categories: DJANGO_APPS, THIRDPARTY_APPS (applications included in the project but not developed by the team) and MYPROJECT_APPS, including just the project application that we have developed.

    # This list is from the builtin applications in django. Watch out for
    # applications that need some specific order, like django-grappelli in
    # this case. It's a third part app, but due to the load order, we must
    # put it here.

    # This list is from the third party software included in the project or
    # system-wide dependencies.

    # Modules created for the project and installed by default. You can add
    # here your own modules.


After you have configured your applications variables, you must declare the languages you will use on the project with LANGUAGES. If you already have a multilingual django project it’s quite probable that you already have this defined. If not, you will have to define a python dictionary with LANG_CODE:LANG_NAME. For example:

    ('es_ES', 'Espanol'),
    ('en_GB', 'English'),
    ('gl_ES', 'Galego'),

How to use the script

This script is run from the command line, in the project root or in the scripts directory. If you don’t exceute it from there it will fail to locate the file. It has three basic commands:

  • make Creates (or updates) all the language catalogs in your project
  • compile Compiles after translation all the language catalogs
  • clean Removes all the language catalogs from the project. Asks for confirmation first

There is also a “help” command which output is:

$ ./ --help
usage: [-h] {make,compile,clean} ...

e-cidadania language catalog generator. This script manages all the .po and
.mo files from templates, python code and javascript i18n (if used).

positional arguments:
    make                Create all the language catalogs for translation,
                        including JavaScript.
    compile             Compile all the language catalogs for use.
    clean               Delete all the language catalogs. After this you will
                        have to rebuild the catalogs and translate them.

optional arguments:
-h, --help            show this help message and exit

For example, to create or update your language catalogs, the command would be:

$ python make

Which output should be (we’re using e-cidadania project as example):

>> Languages to generate:
 - Espanol
 - English
 - Galego

>> Installed applications:
 - accounts
 - proposals
 - news
 - debate
 - spaces
 - staticpages
 - cal

>> Generating language catalog: accounts
processing language es_ES
processing language en_GB
processing language gl_ES

>> Generating language catalog: proposals
processing language es_ES
processing language en_GB
processing language gl_ES

(after ending the standard catalogs it starts with JavaScript ones)

>> Generating JavaScript language catalog: accounts
processing language es_ES
processing language en_GB
processing language gl_ES

>> Generating JavaScript language catalog: proposals
processing language es_ES
processing language en_GB
processing language gl_ES

(etc., etc.)
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-modular-languages-0.5.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Mar 9, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting