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.
Installation and configuration
To install and setup the TranslateSvg extension (warning: the current status of the extension is strictly alpha): 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 the following to your LocalSettings.php:
$wgFileExtensions[] = 'svg'; # Allow SVG uploads
Change the SVG rasterizer to rsvg
. Install librsvg with, e.g., sudo apt-get install librsvg2-dev
. Then, add this to your LocalSettings.php:
$wgSVGConverter = 'rsvg';
Tweak $wgSVGConverters['rsvg']
as required. For example,
$wgSVGConverters['rsvg'] = 'rsvg-convert -w $width -h $height $input -o $output';
Check that an SVG you've uploaded renders; consult Manual:SVG if it does not. Add this to your LocalSettings.php:
$wgNamespacesWithSubpages[NS_FILE] = true; # Allow subpages in the File: namespace
Install the Translate extension, TranslateSvg branch. To do this, you can either grab it from Git (clone, then run git checkout -b translatesvg remotes/origin/translatesvg
), or get a snapshot from Gitweb and extract it. Rename that folder to something more convenient e.g. extensions/Translate.
Next, configure the Translate extension. First, edit your LocalSettings.php, full options are available at Help:Extension:Translate/Configuration, but this should do it for our purposes:
require_once( "$IP/extensions/Translate/Translate.php" );
$wgGroupPermissions['*']['translate'] = true;
$wgTranslateDocumentationLanguageCode = 'qqq';
$wgTranslateEC = array();
$wgTranslateMessageIndex = array( 'CachedMessageIndex' );
$wgCacheDirectory = 'cache';
Install the TranslateSvg extension by downloading a .tar.gz file from Special:ExtensionDistributor/TranslateSvg, and extract it in the same manner, so that extensions/TranslateSvg now exists. You can also clone it from gerrit. Add this to your LocalSettings.php:
require_once( "$IP/extensions/TranslateSvg/TranslateSvg.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):
$wgTranslateSvgBotName = 'SVG translation updater'; # Feel free to change
(optional) Register that username on your wiki, and probably give them the bot flag.
Now, run maintenance/update.php. You may also need to open up the permissions on the cache/ directory.
Navigate to an SVG file containing a string, and follow the link to start translation.
Status
[older items hidden in an HTMl comment]
- 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]
- Investigate making private wiki public [Done]
- Consider modifying/removing "suggestions" [Done]
- Write wizard/instruction page [Done]
- Get from from 93.5% to over 95% [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]
- Seek and resolve code review for phase 2 [Doing]
- Seek and resolve code review for phase 3 [Doing]
- Have all hooks and other modifications to Translate signed off, branch merged
- Change namespace from File to Translations
- Rewrite thumbnailpage to use API
- Consider re-adding an improved form of suggestions
- Use Font::findFontFamily
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
Preliminary designs
- Example SVG file translation page, showing translatable strings
- Example SVG string translation window
- Example SVG file description page, showing possible new links
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.
Deliverables
Required deliverables
The final extension should:
- be able to handle the translation 99%+ of text embedded in SVGs, taking account of (for example) meaningful
tspan
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.