Accessible Publishing Knowledge Base

Language

Summary

...

Techniques

The language of any text content contained within an SVG image should always be set to ensure that assistive technologies render the content properly.

When attached to the root svg element, the xml:lang attribute identifies the default language of any text content in the image.

The xml:lang may also be attached to individual components and text elements within the image to designate that they contain prose in a language other than the default for the image.

Examples

Default language specification

<svg xmlns="http://www.w3.org/2000/svg" xml:lang="en">
   …
</svg>

Language override

<svg xmlns="http://www.w3.org/2000/svg" xml:lang="en">
   …
   <text … >I think therefore I am...</text>
   <text … xml:lang="fr">Je pense donc je suis...</text>
   <text … xml:lang="it">Penso dunque sono...</text>
   <text … xml:lang="ja"></text>
   …
</svg>

References

Frequently Asked Questions

Do I need to specify the language when my image is embedded in an XHTML content document with an in-scope language attribute?

Technically no, since the SVG image will inherit the default language that has been specified. It is, however, more prudent to always specify the default language for any encapsulated instances of xml markup, like SVG images and MathML. You will ensure that any text content is rendered properly by assistive technologies regardless of the default context (e.g., in case your image gets rendered in an unanticipated way, such as in a pop-out window).