Please report all bugs and feature requests via the Wikimedia Phabricator #SVG Translate Tool project.
All methods of installation require the registration of an OAuth consumer
on the wiki to which you will upload SVGs (probably a local development wiki).
Do this via e.g. http://localhost/wiki/Special:OAuthConsumerRegistration/propose
and make sure you include the following grants:
- Create, edit, and move pages
- Upload new files
- Upload, replace, and move files
The OAUTH_URL
environment variable must be set to the long form of the URL
such as http://localhost/w/index.php?title=Special:OAuth
.
To configure the wiki that's used to fetch images and for upload
you should also set WIKI_URL
environment variable
to the API URL of your development wiki, e.g. http://localhost/w/api.php
.
Prerequisites:
Install code and start development environment:
git clone https://github.com/wikimedia/svgtranslate
cd svgtranslate
cp .env.dist .env
docker-compose up
Now you should be able to view the tool at http://localhost:8042/.
A wiki is also available at http://localhost:8043/,
to which you'll need to upload an SVG file or two.
Log in as Admin
with admin123
.
To work with uploading, you'll need to register a new OAuth consumer on that wiki,
and add its key and secret to your .env
file.
The data for the wiki is kept in the var/wiki/
directory (including the Sqlite database)
so it will persist when Docker is not running.
The usual commands you'll need for development are as follows:
-
If you change anything in
assets/
you'll need to rebuild the asset files (runningnpm install
before the first time doing this, if you haven't already):docker-compose exec assets npm run build
Or, to have it monitor the files for changes while you're working (note the double-hyphens to to prevent the
watch
flag from being treated as an argument tonpm
):docker-compose exec assets npm run watch
-
If you change
composer.json
orpackages.json
, you need to update:docker-compose exec web composer update docker-compose exec assets npm update
-
To run tests:
docker-compose exec web composer test docker-compose exec assets npm run test
You can get to a shell inside any of the containers with the following:
docker-compose exec <service_name> bash
Prerequisites:
Install code and dependencies:
git clone https://github.com/wikimedia/svgtranslate
cd svgtranslate
composer install
npm install
Run development web server:
./bin/console server:run
Run tests:
composer test
npm run test
Generate assets:
npm run build
The tool is deployed in a tool/
directory in the tool's home directory,
with tool/public/
symlinked from public_html/
.
To deploy, first checkout the relevant version into tool/
,
and then load the PHP and Node installation jobs from the home directory:
$ toolforge-jobs load tool/toolforge/install.yaml