Category talk:SVG simplification by text switch

Text editor vs Tools edit

Vector graphics tools (Inkscape, Adobe Illustrator, ...) can generate very complicated graphics, which are not useful to be made without their help. As a matter of fact, these tools often generate a lot of unnecessary cruft, not caring whether it may be useful or not. Made with such a tool, even a very simple drawing can look very complicated and have a size much larger than would be reasonable. A lot of examples exist in the Wikimedia, the worst ones are from Adobe:

There exists also a large collection of huge files drawn with an unknown tool, e.g. this   very simple file of 58 KB.

When an SVG file is generated by one of the vector graphics tools and therefore consists of code which is difficult to read, another tool to maintain the embedded multilingual text, e.g. add languages, correct translations, can be very helpful.

When an SVG file is drawn "by hand", i.e. with a text editor, normally it will be very easy to read, and the maintainance of the text and everything else can be and should be always done "by hand". Treating it with a programm, a vector graphics tool or a translation tool, can swift and easily destroy the readability and make it uneditable for text editors.

Multilingual files edit

Often users make a new language version from another language - always an SVG file for just a single language, instead of creating one multilingual file containing a lot of languages. Independent of the fact whether it is a simple SVG drawn with a texteditor, or complicated graphics where a tool seems more useful, the multilingual text part can always be edited with a text editor.
Often it is possible to keep the textual part at the beginning of the SVG code, when the text does not need to be written over a background drawing. That has the advantage that the textual part will be easier to find within the SVG source code. With very large files, it may be necessary to add a switch element near the beginning of the file. MediaWiki may not find systemLanguage attributes in files larger than 256 kB.

It seems useful to keep that textual part as source code on the description page, where several additions can be edited before a new version is uploaded.
By this way, adding new languages and format corrections are easy with a text editor.

About the <switch> element edit

The main usage of the SVG <switch> element is to draw text in an SVG image.

The <switch> element enables to show different shapes depending on what language is valid for that SVG file, either any language code that is specified for the display of a file, or defaulted by the language assigned to the user of the SVG viewer. Typically the <switch> element is used to show different texts, but as well different shapes can be shown.

Depending on the language chosen by the user, one of the coding parts inside the <switch> element, e.g text, will be displayed.

An SVG file may contain as many <switch> elements as needed; each <switch> element contains as many systemLanguage attributes as needed. Only one language code can be valid for the display of an SVG, corresponding to the codes specified in the systemLanguage attributes.

The systemLanguage attribute should be a list of IETF language tags (IETF langtags).

Compared to the possible parametrizing of e.g. a template, the use of the <switch> element is very limited: only one single systemLanguage of all can be activated, all the others are switched off.

 
Greek flagicon. This SVG file will display one of many European flags based upon the lang parameter.

The switch element can do more than just select text in an appropriate language. For example, File:MultEurope.svg will display a European flag based upon the selected language. For example, one can display a Greek flag with [[File:MultEurope.svg|thumb|Greek flagicon|lang=el]]. Here is the relevant SVG that selects the Greek (IETF langtag el:

<g systemLanguage="el">
<clipPath id="t"><rect width="36" height="36" rx="4"/></clipPath>
<g clip-path="url(#t)"> 
<rect fill="#EEE" width="36" height="36"/>
<path stroke="#0D5EAF" stroke-width="4" d="m10,2H36m0,8H16m0,8H36m0,8H0m0,8H36"/>
<path stroke="#0D5EAF" stroke-width="8" stroke-dasharray="6,4" d="m0,4h16m0,12H0"/>
</g></g>
:
Return to "SVG simplification by text switch" page.