README.rst 4.25 KB
Newer Older
1
2
3
4
5
6
7
8
9
=========================
Pootle Translation Server
=========================

This document describes how to install a personal Pootle translation server.

Requirements
============

10
11
12
13
14
15
- `Ansible <http://docs.ansible.com/>`_. We use Ansible to easily deploy Pootle and scripts to the server.
  The deployment receipes and scripts are found in this Git project.

- Linux server. We will use a blank `Debian AMD64 <https://www.debian.org/CD/netinst/>`_ virtual
  machine to start with. Installation was done with only a SSH server running and command :command:`sudo`
  being available.
16
17
18
19
20


Installing Ansible
------------------

21
22
Ansible is needed on a so-called "Control Machine"; that is, a computer that will control the Pootle
server. This is typically your personal computer.
23

24
25
We will install Ansible from source since this is the recommended method. Just pick your preferred
user directory and::
26
27
28
29
30
31
32
33
34
35
36
37
38

    $ sudo easy_install pip
    $ sudo pip install paramiko PyYAML Jinja2 httplib2 six
    $ git clone git://github.com/ansible/ansible.git --recursive
    $ cd ./ansible
    $ source ./hacking/env-setup

Configuring Ansible
-------------------

Edit or create file :file:`/etc/ansible/hosts` and put a reference to your (blank) server::

    [pootle]
39
    192.168.81.128    ansible_ssh_user=xavier
40
41
42
43
44
45

Provisioning Pootle server
--------------------------

Run::

46
47
    $ git clone https://git.typo3.org/Teams/Translation.git
    $ cd Translation
48
49
    $ ansible-playbook -s install.yml

50
51
52
53
54
55
.. note::
    You may need to specify your password for :command:`sudo`, if Ansible fails with ``ERROR! Missing sudo password``.
    If so, you may ask to be prompted to give it like that::

	    $ ansible-playbook -s install.yml --ask-sudo-pass

56
57
58
Administrating Pootle
---------------------

59
60
In default Pootle installations, an admin account (the password matches the username) is created with
superuser privileges which can be used to administer the whole site.
61

62
63
64
.. caution::
	It's highly recommended that you change the password for the default admin account on your first
	login, or even delete the account and assign superuser rights to another user.
65
66
67
68
69

When logging onto your server, you are encouraged to work as user "pootle" and follow the guide::

    $ sudo su - pootle

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Fetching private localisation packages within TYPO3
---------------------------------------------------

Once you have your private Pootle server, and use the scripts to regularly (e.g., daily) prepare
localisation packages, you will need to hook into TYPO3 to automatically change the mirror URL it
uses to fetch localisation packages so that your own server is used instead.

To do that, take your extension, and within :file:`ext_localconf.php`, add::

	/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
	$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);

	$signalSlotDispatcher->connect(
		version_compare(TYPO3_version, '7.0', '<')
			? 'TYPO3\\CMS\\Lang\\Service\\UpdateTranslationService'
			: 'TYPO3\\CMS\\Lang\\Service\\TranslationService',
		'postProcessMirrorUrl',
		'MyCompany\\MyExtension\\Slots\\CustomMirror',
		'postProcessMirrorUrl'
	);

then, create file:`my_extension/Classes/Slots/CustomMirror.php`::

	<?php
	namespace MyCompany\MyExtension\Slots;

	class CustomMirror {
		/**
		 * Post-processes the mirror URL for a given extension key.
		 *
		 * @param string $extensionKey
		 * @param string &$mirrorUrl
		 */
		public function postProcessMirrorUrl($extensionKey, &$mirrorUrl) {
			if ($extensionKey === 'my_extension') {
				$mirrorUrl = 'http://my-custom-server.example.com/l10n_ter';
			}
		}
	}

110
111
112
113
114
115
116
117
118
119
120
121
122
123
Migrating data from production
------------------------------

- Copy po files from production and deploy to new server
- Dump the production database
- Remove every database table from new Pootle server
- Import production database dump
- Run::

      $ sudo -u pootle /opt/local/pootle/bin/pootle --config=/etc/pootle/pootle.conf setup

- Migrate XLIFF to global space with unique id::

      $ sudo su - pootle
124
125
	  $ ~/scripts/bin/migration/1-migrate-typo3-xliff
	  $ ~/scripts/bin/migration/2-project-renamer
126
127
128
129

- Update your password to be "password"::

      UPDATE auth_user SET password='sha1$b5711$bb690a5a16cff60ae3b01fa285bcb2e68cd244f7' WHERE username='admin';