Is there a way to create multilingual SVG files for the web?
I have an SVG with text that I use on a website.
Now if the user changes the language on the website I should normally create a new images for that language. Is there a way to add translation strings to an SVG that change based on some parameter?
Answer
If I were you I would use jQuery to detect what language the browser is and use separate files, such as:
icon_de.svg
icon_en.svg
icon_se_svg
Then with jQuery use navigator.language
to detect the language and if you have that SVG set then append to icon_.svg
.
Example for navigator.language
:
if (window.navigator.language != "en") {
doLangSelect(window.navigator.language);
}
Research:
Attribution
Source : Link , Question Author : juFo , Answer Author : Community