Archive

Posts Tagged ‘i18n’

Installing Pootle 2.1.6 on Ubuntu

Pootle is a web-based tool that eases collaborative translation effort on software projects. This tool allow people to log in into a single interface in order to translate projects’ files, review them, etc…

The tool seems to be used by many well known open-source projects (mozilla, filezilla, …) – It also seems that the reason for Pootle’s popularity is primarly its ‘open-sourceness », and visibly the lack of alternative projects that do the same particular thing : allow non-developper to contribute text translations on software projects through a web interface.

IMO it lacks some important features concerning the synchronization with the sources of a project, for example under subversion. When creating a new project, things have to be done manually on the server, and this involves creating files and symlinks in a way that is really complicated. It gives the test of something that is quite unifinish, and needs a bunch of extra hand written scripts in order to work properly.

I found it to be too simplistic : I wanted to be able to get some non-developpers provide their translation, and being able to seemlessly commit their improvements into the project’s repository under subversion.

Anyway I wanted to give a try to this tool, and I found that the package provided for ubuntu was a bit old, that’s the reason why I give you the steps I followed to to install pootle 2.1.6 (which is the latest version at the time I write this article)

This installation involves apache server + mod_wsgi and mysql, so it is attended to be reliable enough for production mode, as far as I know.

1) you need python => should be already installed / if it’s not the case, apt-get install python

2) you need apache2, mysql, and various python libraries.

sudo apt-get install apache2 libapache2-mod-wsgi python-django python-mysqldb python-lxml python-levenshtein pylucene

3 ) You need ‘translate-toolkit’ : This is the library that pootle uses to manage translations. pootle 2.1.6 need translate-toolkit 1.9.0. Installing it is quite easy :
cd ~
wget http://kent.dl.sourceforge.net/project/translate/Translate%20Toolkit/1.9.0/translate-toolkit-1.9.0.tar.bz2
tar -jxvf translate-toolkit-1.9.0.tar.bz2
cd translate-toolkit-1.9.0
python setup.py install

4) You need pootle (off course) : I install it into /var/www :

cd /var/www
wget http://heanet.dl.sourceforge.net/project/translate/Pootle/2.1.6/Pootle-2.1.6.tar.bz2
tar -jxvf Pootle-2.1.6.tar.bz2
chown -R www-data:ww-data Pootle-2.1.6
ln -s Pootle-2.1.6/ pootle
rm Pootle-2.1.6.tar.bz2

Install it (copies configuration files into various standard places)

/var/www/pootle/setup.py install

add execution right on the script that apache will run through mod_wsgi

chmod 770 /var/www/pootle/wsgi.py

Ensure that the settings file that will be used is the one that stand now in /etc/pootle :

rm /var/www/pootle/localsettings.py
ln -s /etc/pootle/localsettings.py /var/www/pootle/localsettings.py

5) mysql database creation
No particular things to do, just create a database as usual

apt-get install mysql-server


mysql -u root -p
CREATE DATABASE pootle CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON pootle.* TO pootle@localhost IDENTIFIED BY 'secretpassword';
FLUSH PRIVILEGES;

exit

6) Pootle configuration

edit the /etc/pootle/localsettings.py file in order to rely on the mysql database you just created :

DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'pootle' # Or path to database file if using sqlite3.
DATABASE_USER = 'pootle' # Not used with sqlite3.
DATABASE_PASSWORD = 'secretpassword' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''

7) memcached configuration

Instructions from the pootle installation guide recommended to use memcached in order to improve performances,
so I just installed/configured it simply by doing :


sudo apt-get install memcached python-memcache

in/etc/pootle/localsettings.py :

CACHE_BACKEND = ‘memcached://localhost:11211/’
SESSION_ENGINE = ‘django.contrib.sessions.backends.cached_db’

8) Apache configuration :

Pootle runs on python, and the pages are served by apache using mod_wsgi. Here is the configuration file for apache.

I put this configuration in /etc/apache2/sites-available/pootle. static content will be served directly by apache :

<IfModule wsgi_module>

WSGIDaemonProcess pootle_wsgi user=www-data group=www-data processes=10 threads=1 maximum-requests=10000
WSGIProcessGroup pootle_wsgi
WSGIApplicationGroup pootle_wsgi
WSGIPassAuthorization On

WSGIScriptAlias /pootle /var/www/pootle/wsgi.py

# directly serve static files like css and images, no need to go through mod_wsgi and django
Alias /pootle/html /var/www/pootle/html

<Directory /var/www/pootle/html>
Order deny,allow
Allow from all
</Directory>

# Allow downloading translation files directly
Alias /pootle/export /var/www/pootle/po
<Directory /var/www/pootle/po>
Order deny,allow
Allow from all
</Directory>

</IfModule>

, and then enable this settings it by running

a2ensite pootle ; /etc/init.d/apache2 reload

Pootle is now reachable at   http://localhost/pootle

Publicités
Catégories :Uncategorized Étiquettes : , ,