Medien-Datenbank des WikiMANNia-Projekts
Media database of WikiMANNia project – Base de datos multimedia del proyecto WikiMANNia – Database multimediale del progetto WikiMANNia
Die Dokumente und Bilder sind eventuell urheberrechtlich geschützt. – The documents and images may be copyrighted. – Los documentos e imágenes pueden ser propiedad. – I documenti e le immagini possono essere protetti da copyright.

Translation possible/Learn more

From WikiMANNia Commons

Deutsch | English | español | français | italiano | português | русский | +/−

Nuvola apps locale.svg

How to translate an SVG file

Template:See This page explains how to translate inside labels or captions in an SVG file. You are probably here because someone tagged an image with Template:Tlx. Please note that this template and its related pages is a one-man idea. If you have questions or comments about it, please use the template discussion page.

Using numbers instead of labels

On images with few labels, an alternative is to have only one file with numeric labels in it and a table below, with different translations, and there is thus a single image can be used for all languages. Image:Robal.png is a good example.

If you think this image will be better with numbers instead of translated text, you can change Template:T template to Template:T or make numbers yourself.

For instance, Image:ISS configuration sep-2006 en.svg has English labels, and a version with numeric labels Image:ISS configuration sep-2006 numbers.svg was created by replacing the labels in the English version. But it's still not fully internationalized, because title and date are still written in the image in English.

What is SVG?

SVG is an image file format that consists of plain XML text. Therefore the text labels stored in it can be easily translated. For more information about SVG or XML, please use the links. There are Wikipedia articles in many languages.

How do I edit SVGs?

An example of a simple SVG with translations in one file. Go to file's page and render this text in English, German, French and Spanish

There are different ways to translate text in SVG:

  • Use a graphics editor such as Inkscape. For compatibility, save the file as "Plain SVG", not "Inkscape SVG", as the latter format may introduce errors, even though it complies with the SVG specification.
  • Edit the SVG file as a text file.

For editing image in any offline editor, first download the file you want to edit, open the file in the editor, translate the labels, and then save it. When finished, upload the file to Commons under a new name.

Text editing

Note that instead of using a graphics editor, you can use any text editor capable of using UTF-8. Find text to translate by searching for <text> tags. In some cases this might be a path for more advanced users as text coordinates adjustments might be needed and some more advanced "garbage" might decrease readability of the SVG.

How to place new language version in Commons

When creating SVG files for multiple language versions, it would be good, by Commons:File naming, to save them with language-specific name. To avoid a naming conflict with other languages, you can put the language suffix (such as -en for English) just before .svg file extension. For example, Keep your environment clean-en.svg is the English version of "Keep your environment clean.svg".

For linking different versions of file one to another, use "other versions" templates like all in Category:Other versions templates. Copy one of them and use in your image.

It would look like this:

[edit]

Translate
This SVG file contains embedded text that can be translated into your language, using an SVG supportive editor (like XML or text). For more information see: About translating SVG files.

Also the template Template:T will be useful to display link to original version of your localized image.

Multiple translations within one SVG file

An example of a simple SVG with translations in one file. See the description page for details

You can place multiple translations into one SVG file using the SVG <switch> element.

When you have a <switch> element, its children (sub-elements) represent possible choices. The children of the switch should have a systemLanguage attribute that specifies the language. SVG sequentially looks at each child; if there is a systemLanguage attribute and it does not match, SVG moves on to the next child. If the systemLanguage attribute matches or is not present, then SVG renders that child and does not look further. Omitting the systemLanguage attribute from the last child will implement a default rendering.

<syntaxhighlight lang="xml" translate="no"> <switch transform="translate(100,200)">

 <text systemLanguage="en">Population pyramid of Russia (2010)</text>
 <text systemLanguage="de">Alterspyramide von Russland (2010)</text>
 <text systemLanguage="ru">Половозрастная диаграмма России (2010)</text>
 <text>Population pyramid of Russia (2010)</text>

</switch> </syntaxhighlight>

Even if the default rendering is English, it is good practice to place an explicit systemLanguage="en" with the same text. The language matching rules can give unexpected behavior when the file is opened in a browser configured for multiple languages. If the languages do not follow the same sequence in each switch, then a browser may display a mix of languages. In addition, the language matching rules will change in SVG 2.0.

You can also have a systemLanguage attribute on an element that is not a child of a switch element. In this case the element will only be rendered if the language matches. Otherwise the element in question will not be displayed.

Currently, only a few graphical SVG editors support language switches in SVG, so you will probably have to edit the SVG file with a text editor. Loading an SVG file with switch translations into a graphical editor and then saving it may remove all the translations.

The different text translations will have different lengths, so the text anchor point should be chosen carefully. The text-anchor attribute can be set to "start" (left justified in most languages), "middle" (centered), or "end" (right justified). The text elements default to x="0" and y="0", so the switch element can set the text anchor point with transform="translate(100,200)".

When rendering a multi-lingual SVG image on a MediaWiki page, the language to use can be specified using syntax like [[File:SystemLanguage.svg|lang=de]]. The attribute "lang" is optional; if it is missing, MediaWiki will render the SVG in the language "en".

Note: If a file has an English text and a default text specified, the default display on the file page is not the default text but the English text!

See also

Language codes

Click here to show a list of all language codes supported:

Support this template

You don't have to translate this part; it should be enough if this information is here in English. Users who do not yet have a version in their language will find it here, I guess.

You can support this template by translating this help page into your language and saving it as a sub-page. The template consists of three parts. For example, for the German template they are:

The template page should contain the template itself and the quick info text translated from the English template.

The help page (this page) in your language should be saved under the subject that you would use in your language, like "Learn more" (which I selected for English).

The language link template is the same for every version of this template. It contains all the links to existing language versions. Please add your language there and there, if you have created a new translation.

Thank you for your support!