Commons:SVG Translate tool
This page is for documentation regarding SVG Translate tool on Toolforge.
Purpose
[edit]SVGTranslate tool is built for the purpose of easy translation of SVG files. The tool allows users to translate any SVG file on Commons that has machine-readable text labels. The translations are added to the same image file using switch-translations. By doing this, translations are preserved over time even if the image gets modified. You can read more about it here.
History
[edit]This tool is a successor to the older SVGTranslate tool which was maintained by User:Jarry1250. After that tool was no longer maintained, it was proposed as a project in the 2017 Wishlist survey. The project ranked #9 on the wishlist results list. In late August 2018, meta:Community Tech began working on this project. A lot of community members were consulted during the design and development process of the tool.
Usage
[edit]Picking a file to translate
[edit]This is the landing page for the svg-translate tool. On this page, you can use the file search capabilities to search for any SVG on Commons. Keep in mind that you will only be able to translate SVGs which have machine-readable text labels. For other SVGs you will need to use an image-editing software like Inkscape.
Choosing the translation language
[edit]After selecting an image, you will see the translate view. In this view, on the left you see the image labels and blank inputs for adding translations. On the right, you see the image. Before adding label translations, you need to select the language you want to translate the file into. To do this, click on the Select a language dropdown above the input boxes. Then you can use ULS to select your language.
Adding translations for image labels
[edit]Once you have selected a language you want to translate your file into, you will be able to add translations for the labels. As you complete translation for each label, the tool will generate a new image with the added translation in the image. As you can see in the image on the left, the two translated labels have been added to the image.
Note that it may take a little while for the preview to be generated and rendered. It takes longer for complex images with more text labels.
Uploading translations to Commons
[edit]After all the labels have been translated, you can upload the image to Commons by clicking the Upload to Commons button above the image. Please note that in order to upload, you need to login first. You can do this using the login button on top right.
Using translated file on a wiki
[edit]After you have added translations for a file, you can go to the file page on Commons and select the language you want to see it in by using the Render this image in dropdown on the file page. See image on left.
After changing the language, you will be able to see the added translations in the file. To embed the file in your wiki, you can directly embed it and the SVG will be displayed in the language of the wiki, if that translation exists. If no translation is found, the image is displayed in English.
For example, if you add Hindi translation for File:Fire triangle 2.svg, and you want to embed it on an article on Hindi Wikipedia, you can do that by adding [[File:Fire triangle 2.svg]]
on Hindi Wikipedia and it will show the Hindi translation if it exists. If it does not find Hindi translation for the image, it will show the English labels. If you want to display the Hindi labels on a different language project (like punjabi), then you can embed it by using [[File:Fire triangle 2.svg|lang=hi]]
.
FAQ
[edit]Q: Why do I see the message This file does not have any labels available for translation?
[edit]A: There are many reasons for this message to appear:
- A file may have drawn text, but the tool can only find text that is in a machine-readable format (the text must be in a
text
element). For example, File:Nuvola apps edu miscellaneous H2O.svg has drawn text labels that the tool does not recognize. - The tool may be accessing an outdated version of the SVG file. When the tool accesses an SVG file from Commons, it puts it in its own cache. The tool will never check Commons for a more recent version of a cached file, so the user must wait until the file ages out of the cache (in 5 hours or more). There is not a way to purge the cache. In particular, doing
&action=purge
on Commons does not purge the tool's cache. phab:T213126, phab:T216207 - The tool expects the
switch
elements that are used in multilingual files to have a particular, simple, structure. The immediate children should betext
elements that are the translations. The tool does not expect, for example,a
(anchor/hyperlink) org
(group) elements. The tool requires a default translation (atext
element child without asystemLanguage
attribute). The tool expects all the translations to have the same number oftspan
elements as the default translation. For example, if the default translationtext
element has notspan
child elements, but an existing German translation has all its text within atspan
, then the tool will not display any German text. phab:T230357, https://svgtranslate.toolforge.org/File:T230357.svg - The tool is confused by CSS ID selectors in the
style
element, e.g. Blocked
Null all. phab:T231143
- If the tool fails on one element it fails on all. phab:T248252
- The tool does not support nested Blocked
Null all. phab:T250607
Q: Why is the Upload to Commons button disabled?
[edit]A: Files cannot be uploaded to Commons unless you are logged in. You may login using the Login button on top-right of the page. You will be presented with the OAuth permission screen. You will need to click Accept to allow the tool to upload the file to Commons on your behalf.
Q: What does the Default language in the language dropdown on the left in translate view mean?
[edit]A: When the SVG image does not indicate the language it is in, the system assumes that it is in Default language. The tool does not know if it is English or Spanish or some other language.
Q: Why do I see the message The file you requested could not be found?
[edit]A: This message is displayed when the image name requested does not exist on Commons. Please check for spelling errors in the file name and double-check on Commons. Note that only images present on Commons can be translated using this tool. You can upload your SVG file to Commons in order to use this tool to translate it.
Q: The order of labels is wrong for my language. How can I fix this?
[edit]A: The easy way is to add the translations in the correct order (that is, insert the right translation for the wrong label). The preview feature will help you see if it appears correctly in the image. This is not a good solution and we are trying to find a way to fix this problem in the long term but we cannot guarantee a solution because SVGs can be very complex.
Q: Why do I see the message Only SVG files are supported?
[edit]A:
- It is not possible to translate any file formats other than SVG (i.e. with a file extension of
.svg
). The SVG Translate tool is linked from a template on Commons, and so it's possible that this template is used on non-SVG files and in these cases you might end up seeing this error. There may be an SVG version of the image you're trying to translate (check for the {{Vector version available}} template on the file's page). - phab:T251702 missing XML-information might confuse the converter
See also
[edit]- Commons edits made via SVG Translate 1.4 -- if no uploads are shown try to update to the current SVG translate version in
&tagfilter=OAuth+CID%3A+