User Tools

Site Tools


operating_systems:linux:debian:pootle_installation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
operating_systems:linux:debian:pootle_installation [2013/04/12 09:16] – created tretoperating_systems:linux:debian:pootle_installation [2014/09/17 15:16] – [How to do with de prod server ?] sbolay
Line 30: Line 30:
 ===== Configuring Apache ===== ===== 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
 +<code bash>
 +#!/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
 +</code>
 +
 +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
 +   msgmerge -U def.po ref.pot
 +
 +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.myserver.com:my_project-locales.git my_project-locales
 +   cd my_project-locales/
 +   git remote add prod git@server3.myserver.com:my_project-locales.git
 +   git pull origin master
 +   git push prod master