Pootle

From SME Server
Revision as of 06:29, 18 April 2021 by Unnilennium (talk | contribs) (→‎Pootle website)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Pootle Translations

  Skill level: Advanced
The instructions on this page may require deviations from standard procedures. A good understanding of linux and Koozali SME Server is recommended.


Description

The Translate Toolkit and Pootle provide a way to make it easier to localise using standards based file formats (PO and XLIFF). Our goal is to make the life of a localiser easier, making it easy to localise, creating high quality tools that help you to work quicker and with higher quality.

Pootle and translation toolkit require python 2.4. SME 7.3 come with python 2.3 configured to run yum and other system utilities. Then you must install python 2.4 without affecting the original python 2.3

Because python 2.4 installation will set as default, you must install in one step all rpms, before yum stop working. Don't worry about that. New python 2.4 come with a dependency package named "alternatives". With alternatives you can set the default python will system be use. For this installation, will we not utilize alternatives, and will we restore the original links. If you know a better way to use alternatives and make python 2.3 as default, and 2.4 automatic, please share with us.

Install

Download all rpms to one directory:

wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/python2.4/rpms/alternatives-0.2.0rc3-9.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/python2.4/rpms/python24-2.4.2-10.el4.pyv.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/elementtree-1.2.7-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/jToolkit-0.7.8-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/kid-0.9.6-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/Pootle-1.2.0-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/lxml-1.2-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/psyco-1.6-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/pysqlite-2.4.1-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/python-Levenshtein-0.10.1-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/translate-toolkit-1.2.0-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/xapian-core-libs-1.0.4-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/xapian-bindings-python-1.0.4-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/xapian-bindings-1.0.4-1.i386.rpm

Install with yum:

yum localinstall *.rpm

Fixing alternatives

If you run python at command line, you will see version 2.4, and you can't use yum anymore, because yum is installed under python 2.3

To fixing, run the following command:

/usr/sbin/alternatives-helper --remove python24
mv /usr/bin/python.alternatives_save /usr/bin/python
mv /usr/share/man/man1/python.1.gz.alternatives_save /usr/share/man/man1/python.1.gz

Now you have again python 2.3 running as default

Start pootle server

Before you can start pootle server, you will must configure an user account. Pootle come with a default user account "startup" with the same password. Edit the file /usr/lib/python2.4/site-packages/Pootle/users.prefs and uncomment the following lines:

startup:
 activated = 1
 passwdhash = 'dd82c1882969461de74b46427961ea2c'
 rights.siteadmin = True
 name = 
 email = 


Then you can add a new user with admin privileges as say in pootle site, and for security reasons, comment again the user "startup".

I suggest you to enable stats_db in the pootle.prefs file for improve the speed. Of course, make the cache directory and uncomment the line stats_db = "/var/cache/pootle/stats.db"

Manually you can start pootle server as indicate in pootle site:

python2.4 /usr/bin/PootleServer --port=8081 > /var/log/pootle.log 2>&1 &

Or better create a file under /etc/e-smith/events/local:

nano /etc/e-smith/events/local/S99Pootle

#!/bin/sh
/usr/bin/python2.4 /usr/bin/PootleServer --port=8081 > /var/log/pootle.log 2>&1 &
chmod 0755 /etc/e-smith/events/local/S99Pootle

To run, execute the above file. To stop Pootle kill the pootle task. The above file allow the server to run pootle at every boot time.

If you can make init scrypt as say ( http://translate.sourceforge.net/wiki/pootle/service_scripts ) share with us and then we will make the service rpm

Access at http://your_server:8081

Of course you can choose other port.

To make accesible outside your lan, run these commands:

config set pootle service access public status enabled TCPPort 8081
signal-event remoteaccess-update

Or proxying through apache: http://forums.contribs.org/index.php?topic=40081

Updating from Pootle 1.1.0 to 1.2.0

Before you try to update, keep a backup copy of /usr/lib/python2.4/site-packages/Pootle

Because new pootle version has a bug with PyLucene search engine, you must remove before continue.

http://bugs.locamotion.org/show_bug.cgi?id=425

We replace PyLucene with xapian search engine

So, before update you must kill (stop) all instances of PootleServer

Remove PyLucene

yum remove PyLucene

Download the new packages under a folder

wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/Pootle-1.2.0-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/translate-toolkit-1.2.0-1.noarch.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/xapian-core-libs-1.0.4-1.i386.rpm
wget http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpms/xapian-bindings-python-1.0.4-1.i386.rpm

Install them with yum

yum localinstall *.rpm

Now copy from you Pootle backup the files pootle.prefs and users.prefs under /usr/lib/python2.4/site-packages/Pootle

Merge the new configuration sections if they are need it: Pootle.stats_db and Pootle.enablealtsrc

I suggest you to enable stats_db in the pootle.prefs file for improve the speed. Of course, make the cache directory and uncomment the line stats_db = "/var/cache/pootle/stats.db"

For cleanup your old pylucene indexes remove all folders .poindex-project-lang under po/your-project folder.

Now you can start PootleServer again.

Conclusions

Pootle is a very good tool to make translations for po files, and with a little configuration, you can translate between various file formats. I think it is usesful for implement at contribs.org for make translations more easily, with all the community online. Also formmagick panels.

News: Now SME server use an online translation tool based in Pootle at http://translate.contribs.org

References

Python 2.4 come from the repository PYVAULT

If you want to add the repo:

/sbin/e-smith/db yum_repositories set pyvault repository \
Name 'PyVault RPM Repository [stable] for Redhat Enterprise Linux 4 (i386)' \
BaseURL 'http://python.org/pyvault/centos-4-i386' \
EnableGroups no \
GPGCheck yes \
GPGKey http://python.org/pyvault/pyvault.asc \
Visible no \
status disabled

and then expand template

signal-event yum-modify

Use as --enablerepo=pyvault


Alternatives

See http://alternatives.sourceforge.net/ page information, or run "man alternatives" at your command prompt.

Pootle website

http://translate.sourceforge.net/wiki/start