Extension:TranslateSvg/2.0

This is the planning page for version 2.0 of the TranslateSvg extension, a project being undertaken by Harry Burt (User:Jarry1250) as part of Google Summer of Code 2012.


 * Ensure you have a working, fairly up-to-date MediaWiki installation (1.18.1 or above should do it)
 * Ensure you have some SVG files on your wiki to translate
 * Follow Manual:Uploads to set up file uploads
 * Add  to your LocalSettings.php
 * Change the SVG rasterizer to
 * Install librsvg (e.g )
 * Add  to your LocalSettings.php
 * Tweak  as required. For example,.
 * Check that an SVG you've uploaded renders; consult Manual:SVG if it does not.
 * Add  to your LocalSettings.php
 * Manually patch your MediaWiki installation to support rendering SVGs in different languages. Firstly, add the following to /w/includes/ImagePage.php, around line ~265.
 * Similarly, /w/includes/media/SVG.php will need to be updated to 1.18.1 or 1.18.1. Backup first, no warranty provided.
 * Install the Translate extension, TranslateSvg branch. To do this, you can either grab it from Git (clone, then run ), or get a snapshot:
 * Download Translate-f46f7e6.tar.gz (approximate size 1.5MB)
 * Extract the Translate-f46f7e6 folder to /w/extensions, such that /w/extensions/Translate-f46f7e6 now exists (Windows users may need to download a program like 7-zip to help with this).
 * Rename that folder to something more convenient e.g. /w/extensions/Translate
 * Configure the Translate extension:
 * First, edit your LocalSettings.php, full options are available at Help:Extension:Translate/Configuration, but the TL;DR version can be summarised as:
 * Second, run /w/maintenance/update.php.
 * You may also need to open up the permissions on /w/cache
 * Install the TranslateSvg extension by downloading a .tar.gz file from Special:ExtensionDistributor/TranslateSvg, and extract it in the same manner, so that /w/extensions/TranslateSvg now exists. You can also clone it from gerrit. Add  to your LocalSettings.php.
 * (optional) Configure TranslateSvg by adding the following line to your LocalSettings.php (there are some other options but you shouldn't need to change them):
 * (optional) Register that username on your wiki, and probably give them the bot flag.
 * Navigate to an SVG file containing a string, and follow the link to start translation

Status
[preliminary work and phase 1 collapsed into an HTML comment]


 * Find a way of using Translate's export feature to run custom export code [Done]
 * Write custom code to export back to SVG via re-upload, no error-handling [Done]
 * Use same code to generate live thumbnails [Done]
 * Code changes to file description pages (with real links). [Done]
 * Consider the impact of unsaved changes on correct file description pages [Done]
 * Push 'TranslateBeforeSpecialPage' and 'TranslateNoSuchGroupFound' to Gerrit [Done]
 * Add colour picker [Done]
 * Understand and write translation fuzzy/invalidation code [Done]
 * Establish a private test wiki on Labs [Done]
 * Write instructions for testing TranslateSvg, if only for self-reference [Done]
 * Work with Krinkle to sign off basic JS hooks system [Done]
 * Seek and resolve code review for phase 1 [Doing]
 * Enquire about temp file clearance issues [Doing]
 * Handle as many errors as possible nicely [Doing]
 * Investigate making private wiki public
 * Seek and resolve code review for phase 2
 * Have all hooks and other modifications to Translate signed off, branch merged
 * Consider modifying/removing "suggestions".
 * Write wizard

Future roadmap

 * 21 July to 11 August: Heavy-duty code review, documentation, and several rounds of testing with real-world translators.
 * 11 August to 20 August: Final polish, integration focussed elements. Pencils down on official project.
 * 20 August to end of October (provisional): Prepare for deployment if required

Suggested workflow

 * User wants to use diagram or other SVG image, but it is not available in her or her language.
 * User clicks link to special page in order to translate it
 * If not already present, a message group is created, filled with defaults, and saved
 * The Translate interface is loaded and displayed to the user.
 * User selects the desired language(s) and translates using Translate interface. After each, the translation is saved back in the usual Translate wiki way.
 * When user is finished with change(s), user can either (a) wait until midnight or (b) press a big save button. After either has been done, the export process reassembles the message files back into the SVG in the form of an "Upload a new version of this file"-style update (checking for edit conflicts and fixing as appropriate!).
 * The user is able to insert the SVG thumb, now translated into the new language, into any MediaWiki document using the lang=xx attribute.

Required deliverables
The final extension should:
 * be able to handle the translation 99%+ of text embedded in SVGs, taking account of (for example) meaningful s, italics, bold, superscript, subscript and other formatting using well-documented methods;
 * provide a functioning, internationalisable and polished interface able to adjust for translations (with a "native" feel and a minimum of visual clutter):
 * in different writing scripts,
 * with different x/y positioning,
 * and in right-to-left (RTL) languages;
 * modify file description pages, to enable visitors to view files in different languages and provide them with easy access to the translation mechanism;
 * be written to cope with "evolving" SVG files, i.e. those which go through a repeated translation-modification cycle;
 * be well documented, or, even better, be sufficiently simple that it needs little in the way of official documentation;
 * implement logical and informative permissions and error-handling;
 * and do all of the above in a resource-efficient manner, even for large SVGs; or, if this proves impossible, at least implement a reasonable upper limit with regard to performance (similar to the long-time situation with large PNG files).

If time permits
The final extension could:
 * provide quality control via a special logging action (reverting being handled natively via MediaWiki);
 * separate a new SVG-translation user right from the usual upload user right to allow for more granular permissions;
 * ensure SVG-file-parsing system is sufficiently logical and/or modular to be easily extensible by future developers.

Further details

 * Results of SVG analysis