Setting up Babel from a Subversion Checkout
Babel can be downloaded directly from the development repository using a Subversion client. For example, to obtain the most recent development version, you'd checkout the trunk directory:
$ svn co http://svn.edgewall.org/repos/babel/trunk babel $ cd babel
Note that you can also access the repository using https if you're having problems with a braindead proxy.
Importing the Locale Data
Now, before you can actually use Babel from such a checkout, you first need to import the CLDR data. To do that, first download a CLDR release from here:
- trunk: CLDR 1.7.2
- Babel 0.9.3 – 0.9.5 (probably 0.9.x): CLDR 1.6.1
- Babel 0.9.0 – 0.9.2: CLDR 1.5.0
- Babel 0.8.x: CLDR 1.4.1
Unzip the core.zip file to a location of your choice.
From the directory into which you checked out Babel, do:
$ ./setup.py egg_info $ ./scripts/import_cldr.py /path/to/cldrdir
This should dump a whole lot of output to the console, and at the end you'll have a large number of *.dat files in the babel/localedata directory.
If you get an error like UserWarning: Unknown distribution option: 'entry_points', you need to install setuptools and try again.
If you work from inside a Mercurial checkout (a clone of the http://bitbucket.org/edgewall/babel mirror, for example), you might get the following error:
IOError: [Errno 2] No such file or directory: '/usr/local/virtualenv/src/babel-mirror/scripts/../babel/localedata/root.dat'
This is because Mercurial doesn't support empty directories and the babel/localedata folder doesn't exist yet. Simply do:
$ mkdir babel/localedata
Note: you'll need to repeat this process whenever you update your working copy and the import_cldr.py file has been changed.
Note that the CLDR import process requires ElementTree, either the version included with Python since version 2.5, or the normal ElementTree download. For Python versions prior to 2.5, easy_install'ing should work (but “normal” installation works, too):
$ sudo easy_install ElementTree
After the CLDR data has been successfully imported, Babel must be installed:
$ sudo ./setup.py install
Running the Testsuite
Currently you will need the pytz module when trying to run the testsuite through the command:
$ ./setup.py test
This is simple to install through easy_install:
$ sudo easy_install pytz
While source tarballs include the generated HTML documentation, repository checkouts only contain the source files. However, it's easy to generate the documentation yourself:
$ ./setup.py build_doc
$ sudo easy_install docutils ... $ sudo easy_install epydoc ... $ sudo easy_install genshi ... $ sudo easy_install Pygments
If you're extending the documentation text files, and are using docstrings, you should make sure those actually work using the following command:
$ ./setup.py test_doc
See also: Documentation