This ticket is to capture the work #community-tech will be doing for the SVG translate project requested in the [2017 wishlist survey](https://meta.wikimedia.org/wiki/2017_Community_Wishlist_Survey/Multimedia_and_Commons/SVG-Translate).
-----
### Problem:
As a user, I want to translate an SVG file with text labels so I can use it on multiple wikis. Here's an example -
SVG of [Anatomy of Human Ear](https://commons.wikimedia.org/wiki/File:Anatomy_of_the_Human_Ear_en.svg) in English. Usage of the file on other wikis:
* [Hebrew](https://he.wikipedia.org/wiki/מערכת_השמיעה)
* [Farsi](https://fa.wikipedia.org/wiki/پرده_گوش)
* [Nepalese](https://ne.wikipedia.org/wiki/कान)
* [Tamil wiktionary](https://ta.wiktionary.org/wiki/செவிப்பறை)
###Current translation solutions:
#####1. [SVG Translate tool](https://tools.wmflabs.org/svgtranslate/) on ToolForge ([code](https://github.com/Jarry1250/labs-svgtranslate/))
**How it works:**
* User enters a file name in the
* The interface contains the SVG image along with an interface to translate text strings found in the SVG:
| {F24746350} | {F24488580, size=full} |
* The user can add translations and select the language the translations are for.
* Once translated, the tool creates [a new, translated version](https://github.com/Jarry1250/labs-svgtranslate/blob/master/svgtranslate.php#L287) of the SVG.
* The user then has an option of either downloading the new SVG version and uploading to commons themselves or uploading from the tool itself (using OAuth)
* The user then links the new translated version to the original version
**Status** - Doesn't appear to work. OAuth is reportedly broken since a long time.
**Notes:**
* The tool has [[ https://github.com/Jarry1250/labs-svgtranslate/blob/master/language.php | 5 languages hard-coded ]]. We will need to change it to add TWN support.
#####2. Manual translation using graphic/text editors
* In the absence of the above tool, it appears that most users use text editors to edit SVG files and upload them. This severely limits the number of people able to do this.
#####3. WIP [TranslateSVG extension](https://www.mediawiki.org/wiki/Extension:TranslateSvg) ([code](https://github.com/wikimedia/mediawiki-extensions-TranslateSvg))
* [GSoC project roadmap document](https://www.mediawiki.org/wiki/Extension:TranslateSvg/2.0)
* [Video](https://www.mediawiki.org/wiki/File:TranslateSvg.ogv) for the working extension
* Based on the video, here's my interpretation of how it works:
** User goes to Special:TranslateSVG
** Inputs the file name
** There is a page which shows all the existing translations
** Click a button to get a pop-up where user enters new language code
** User gets a form with each `<text>` string in original language along with an input box to translate it.
** Every string has an input for X and Y coordinates as well.
** User saves translations.
** The extension modified the existing file and saves translations using the [`<switch>`](https://www.w3.org/TR/SVG11/struct.html#SwitchElement) statement and the [`systemLanguage`](https://www.w3.org/TR/SVG11/struct.html#ConditionalProcessingSystemLanguageAttribute) attribute in the SVG.
** User can embed file using `[[File:ABC|lang=de]]` syntax
**Status:** Extension is not deployed anywhere. The [testwiki](http://translatesvg.wmflabs.org/wiki/Main_Page) that was setup for the extension no longer works.
####A comparison of the ToolForge tool vs the Extension:
| **ToolForge tool** | **TranslateSVG extension** |
|{icon thumbs-o-up color=green} Flexibility in terms of interface|{icon thumbs-o-down color=red} Interface is less flexible (there's a special page for converting SVGs)|
|{icon thumbs-o-up color=green} Any image can be translated, doesn't have to be on Commons|{icon thumbs-o-down color=red} Only images on the wiki the extension is on can be translated|
|{icon thumbs-o-up color=green} Allows for translated images to be downloaded|{icon thumbs-o-down color=red} Translated images can't be downloaded (at the moment) |
| {icon thumbs-o-up color=green} No external dependencies | {icon thumbs-o-down color=red} Dependent on Translate extension |
| {icon thumbs-o-up color=green} Allows for translate links to be shared like [this one](https://tools.wmflabs.org/svgtranslate/?svg=100+Years+War+France+1435.svg) which opens the form for translation (seems broken right now) | {icon thumbs-o-up color=green} Translate also allows for direct links to translate page |
|{icon thumbs-o-down color=red} File save is complex (OAuth authentication & save or manual upload) | {icon thumbs-o-up color=green} Saving the translated file is easy |
|{icon thumbs-o-down color=red} The tool creates a new version of the file for every translation | {icon thumbs-o-up color=green} The extension updates the original file using `switch` statements |
| {icon thumbs-o-down color=red} The tool doesn't allow for modification of X and Y coordinates of the labels | {icon thumbs-o-up color=green} The extension allows for labels to be repositioned |
###Open questions:
* Are there any downsides to embedding multiple translations in the same file as opposed to creating a new file for each translation?
* Are there any downsides to allowing users to modify string coordinates in SVGs?
* Are there any downsides to allowing users to adjust text size in SVGs?
* Is it possible to suggest translations for strings? (Using TranslateWiki or something else)
* Will the StructuredData on Commons project potentially impact this project if we choose to go with the extension?
###Other resources:
* [Category on Commons for translatable SVGs](https://commons.wikimedia.org/wiki/Category:Translation_possible_-_SVG)
** Files added to this category by adding `{{Translation possible}}` or `{{Translate}}` templates to the file page.
* [Category on Commons for SVGs translatable using switch statements](https://commons.wikimedia.org/wiki/Category:Translation_possible_-_SVG_(switch)).
** Files that have at least one existing switch statement come here when `{{Translate | switch=yes}}` is added to the file page.
* https://meta.wikimedia.org/wiki/Grants:Project/Glrx/SVG_i18n