How to Utilize SVG in Localization

SVG (Scalable Vector Graphics) is an XML-based file format for vector images. It’s also a great tool for creating responsive localized graphics for the web.

There are also several other methods for creating localized graphics, like our Get Localization for Photoshop plug-in. If you want to externalize all the texts from your images, you can also use HTML and CSS but it will get difficult if your site is responsive (it’s possible though).

SVG however, is a great alternative as you can use a single base background asset (bitmap or vector), externalize textual content and also leverage the scaling of the SVG image to create a responsive graphical asset. In our example, the background is a single bitmap and looks like this:


Following piece of XML is actually the SVG image and using the above PNG as a base background image.  You can also use full SVG background as well if you’d like. I’ll use the background bitmap image here just to keep the markup simple and easy.

In this example we use Django’s i18n framework for internalization so the texts will be translated the same way as the rest of the website. If you are using some other framework or CMS, the SVG can be embedded into your HTML code which let you employ the same process you have in place for localizing the HTML content.

<svg height="100%" width="100%" viewBox="0 0 1200 598" version="1.1" xmlns="" xmlns:xlink= "">
<image xlink:href="//" x="200" y="0" height="598px" width="800px"/>
<text x="530" y="110" text-anchor="end" font-family="'Bad Script', cursive" font-size="35">
{% trans "Cut'n'pasting" %}
<text x="320" y="275" text-anchor="end" font-family="'Bad Script', cursive" font-size="35">
{% trans "Manual work" %}
<text x="360" y="480" text-anchor="end" font-family="'Bad Script', cursive" font-size="35">
{% trans "Developers" %}
<text x="750" y="510" text-anchor="start" font-family="'Bad Script', cursive" font-size="35">
{% trans "Plug-ins" %}
<text x="880" y="280" text-anchor="start" font-family="'Bad Script', cursive" font-size="35">
{% trans "Time &amp; Money" %}

view raw


hosted with ❤ by GitHub

When the SVG is rendered in a browser, this is how it looks like:


And this is how it looks in Japanese:


It is also fully responsive; image and text both scale correctly and keep their correct positions when you resize your browser.

There are also few important points which you should consider when creating localized assets. Text length varies in different languages, so make sure you have enough space for the translated text. Also, think how the lengthier or shorter text appears in your image. Ask yourself a question: if this text is longer or shorter, what is going to happen? Is it going to overlap the elements or will there be an ugly white space between the text and the element when text is actually shorter like in this example:


You need to make sure that text extends in the correct direction. Luckily SVG lets you define an anchor position for each text element. It’s used to align the text relative to a given point. For example, you may want to set the anchor point to middle if you want the text to always be centered, no matter how long it is. Or if you want to position the text based on the end coordinate, then the last character will always stay in the same position. This is how we can fix the problem in our example.

If you want to use Google Fonts or similar web fonts, make sure they support the languages you want to translate your site into. Google Fonts lets you search fonts by their supported languages.

So it’s not that hard, really! If you need help with your website translation & localization, let us know. Along with professional translation services, we also provide consultation and various tools for workflow management.

Get Localization offers professional translation services and managed translation & localization solutions for all kind of businesses. 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s