User Tools

Site Tools


operating_systems:linux:debian:pootle_installation

This is an old revision of the document!


Pootle Installation

How to install Pootle 2.5.0-rc1 on Debian.

Installing Pootle

Some packages are required in order to build dependencies of Pootle.

sudo aptitude install libxml2-dev
sudo aptitude install libxslt-dev

Now, we can let easy_install handle the heavy lift:

sudo easy_install pootle

We still have to configure Apache to work with Pootle…

Preparing Apache

Pootle will be directly loaded by Apache. We need mod_wsgi to host our Python based application.

sudo aptitude install libapache2-mod-wsgi

Configuring Apache

...
...
...

Create a git repertory for the locales

Create the git repertory

Create a repertory to have the locales

mkdir /srv/http/locales/my_project
chown -R www-data:git /srv/http/locales/my_project
chmod -R 775 /srv/http/locales/my_project

Create the git repertory

cd /srv/git
git init --bare --shared my_project.git
chown -R git:git my_project.git

Create the post-receieve hook in the git project:

vim my_project.git/hooks/post-receive
#!/bin/bash
 
app='my_project'
 
rm -rf /srv/http/locales/"$app"
git clone /srv/git/"$app"-locales.git /srv/http/locales/"$app"
 
for dir in /srv/http/locales/"$app"/*
do
        if [[ -d "$dir" && "$(basename "$dir")" != 'templates' ]]
        then
                mkdir "$dir/LC_MESSAGES"
                mv "$dir/$app.po" "$dir/LC_MESSAGES/$app.po"
		msgfmt -o "$dir/LC_MESSAGES/$app.mo" "$dir/LC_MESSAGES/$app.po"
                mv "$dir" "$dir.UTF-8"
        fi
done

Authorize the execution on the post-receive

 chmod 775 my_project.git/hooks/post-receive

Create the pootle files

Create the repertory in the pootle's files

 cd /opt/translate.bolay.co/pootle/po/
 git clone /srv/git/my_project.git my_project
 cd my_project
 mkdir templates, fr_FR, de_DE

Create the *.pot file

 cd /srv/http/my_domain/my_project/
 find -name "*.php" > temp.txt
 xgettext -f temp.txt -o /opt/translate.bolay.co/pootle/po/templates/my_project.pot
 rm temp.txt

Create the *.po files

 cd /opt/translate.bolay.co/pootle/po/my_project
 cp templates/my_project.pot fr_FR/my_project.po
 cp templates/my_project.pot de_DE/my_project.po
 cd ..

Authorize to write for www-data

 chown -R www-data:www-data my_project
 chmod -R 775 my_project

Configure the site

Then go on http://translate.bolay.co

Login

Administration → project

Add a project (the project's name must be the same as the repertory)

Go on Project → my_project→Administrer

Choose the languages (fr_FR, de_DE, templates)

Now go on each languages and click “Réexaminer les fichiers du projet”

How to use this ?

Go on the site (http://translate.bolay.co) and login

Translate what you want

Click on “Mettre à jour d'après les fichiers modèles”

Now push :

 cd /opt/translate.bolay.co/pootle/po/my_project
 git add .
 git commit -m "my_message"
 git push origin master

And the testing site is translated ! :-D

How to do with de prod server ?

On your mac :

 git clone git@server1.bolay.co:my_project-locales.git my_project-locales
 cd my_project-locales/
 git remote add prod git@server3.bolay.co:my_project-locales.git
 git pull origin master
 git push prod master
operating_systems/linux/debian/pootle_installation.1404813481.txt.gz · Last modified: 2014/07/08 09:58 by czuber