README.rst 3.91 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
39
40
41
42
43
44
45
46
47
48
49
50

    $ 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]
    192.168.81.128

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

Run::

    $ ansible-playbook -s install.yml

Administrating Pootle
---------------------

51
52
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.
53

54
55
56
.. 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.
57
58
59
60
61

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

    $ sudo su - pootle

62
63
64
65
66
67
68
69
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
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';
			}
		}
	}

102
103
104
105
106
107
108
109
110
111
112
113
114
115
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
116
117
	  $ ~/scripts/bin/migration/1-migrate-typo3-xliff
	  $ ~/scripts/bin/migration/2-project-renamer
118
119
120
121
122

- Update your password to be "password"::

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