This ticket is to capture the work Community-Tech will be doing for the SVG translate project requested in the 2017 wishlist survey.
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 in English. Usage of the file on other wikis:
Proposed solution:
MVP:
- A tool on ToolForge that...
- Allows a user to find a file on Commons
- The tool accepts a file URL and auto-completes SVG file names from Commons, if the user starts typing.
- Once the user selects the file, the tool opens the file up in the translate view, where it can be translated.
- Allows a user to add a new language translation
- The user can select what language they want to translate from.
- The user can select what language they want to translate to.
- The user is presented with labels for entering the translations.
- Allows a user to view and edit previously existing translations
- If there are existing translations for a language that user wants to translate to, they get pulled in and are modifiable in the interface.
- Allows a user to preview the file
- The user can hit preview at any stage during the translation process and see the translated labels appear in the image. (Dependent on technical feasibility)
- Allows a user to login to the tool using OAuth
- User can login to the tool at any point and the tool will hold on to all their translations.
- Allows a user to upload the file to Commons under their account (using OAuth)
- This action would be disallowed until the user has added translations for all labels.
- This action would be disallowed until the user has logged in.
- This creates a new version of the same file (translations saved using switch) and leads user to commons where they can input the description/file changes.
- Allows a user to download the file with the new translation
- The user can download the file at any stage (even if all the labels are not translated)
- Allows a user to find a file on Commons
- A gadget that...
- Generates a link to the tool for every image on this category on commons.
- Is customizable to be used for any wiki and any category. -----
Content below left as-is for posterity
Current translation solutions:
1. SVG Translate tool on ToolForge (code)
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:
- The user can add translations and select the language the translations are for.
- Once translated, the tool creates a new, translated version 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 after January 2017. T164275
Notes:
- The tool has 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 (code)
- GSoC project roadmap document
- Video 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 that was setup for the extension no longer works.
A comparison of the ToolForge tool vs the Extension:
ToolForge tool | TranslateSVG extension |
Flexibility in terms of interface | Interface is less flexible (there's a special page for converting SVGs) |
Any image can be translated, doesn't have to be on Commons | Only images on the wiki the extension is on can be translated |
Allows for translated images to be downloaded | Translated images can't be downloaded (at the moment) |
No external dependencies | Integrates with Translate extension |
Allows for translate links to be shared like this one which opens the form for translation (seems broken right now) | Translate also allows for direct links to translate page |
File save is complex (OAuth authentication & save or manual upload) | Saving the translated file is easy |
The tool creates a new version of the file for every translation | The extension updates the original file using switch statements |
The tool doesn't allow for modification of X and Y coordinates of the labels | 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)
Other resources:
- Category on Commons for translatable SVGs
- 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.
- 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