How to Test Language Shifts in EPUBs Using Thorium

Learn how to test language shifts in EPUBs with this step-by-step guide.

  • Subject(s):

    Ebook Production

  • Resource Type(s):

    Step-by-Step, Tools

  • Audience:


Suggested Prerequisites

Before reading this, you might want to read:


While many EPUBs include text in one main language, they may also include a few phrases or sentences in other languages throughout the book. For example, an English language novel may include a phrase or two in French, or perhaps Spanish in some of the chapters. This article discusses how to tag such language shifts in your EPUB, and how to test them using an eBook reading application called Thorium.

What is an example of a language shift?

In the example below, the French phrase is wrapped between <span> tags, and the language shift is noted using the language code “fr-FR”—the code for French (France). Similarly, the language code for French (Canada) is “fr-CA”, and the general code for French is simply “fr”.

Language shifts are noted using the lang= and xml:lang= attributes. The value for each of these attributes denotes the language code, which signals the shift for screen reading software.

A screenshot of code. The phrase j'aime le chocolat is wrapped between <span> tags. The opening <span> tag is underlined in red. <span class="french" lang="fr-FR" xml:lang="fr-FR">

For more information about language codes, check out the following article: Introduction to ISO 639 Language Codes and Where to Find Them.

Testing language shifts using Thorium Reader

Thorium Reader is a free eBook reading application with a text-to-speech function. To test your language shift, activate the text-to-speech button, as highlighted in the screenshot below.

A screenshot of Thorium Reader showing a page from an eBook. The speaker icon at the top is highlighted with a red box. The French text "J'aime le chocolat" is underlined in red.

You may find that even though your language shift is coded correctly, the text-to-speech narration does not pronounce the phrase properly. First, double-check if the language shift was coded with the right language code. Next, check if your computer has the voice package of the language you are testing. If not, you will need to install the voice package manually.

Installing language voice packages on Windows

Below are the steps you can use to install language voice packages on Windows 11:

  1. Go to Settings, then click the Accessibility tab.
  2. From the options under “Vision”, click on “Narrator.”
  3. Under the options for “Narrator’s voice”, click on “Add legacy voices.”
  4. Under “Manage voices” click “Add voices”, then choose the language you wish to test in Thorium from the list of languages. (Note that the number of languages available to download is limited.)
  5. Click “Add.”
A screenshot of available language voice packages in Windows 11.

You may need to close and reopen the settings and any other applications that use voice packages to find the recently downloaded language in your settings. Once the voice package is installed, test the language shift in Thorium again using the text-to-speech function.

Another way to install voice packages in settings is by navigating to “Time & language”, then “Speech”, then clicking “Add voices” under “Manage voices.”

The difference with the Accessibility option outlined above is that you can find related accessibility settings in the Accessibility tab, including device and volume settings.

Installing language voice packages on Mac

Below are the steps you can use to install language voice packages on macOS Ventura:

  1. Go to System Settings.
  2. Navigate to Accessibility.
  3. In the dropdown list next to the “System voice” option, scroll down to “Manage Voices…”
  4. You will find a list of languages on the left side of the window. Click on the language you want to download. There will be a list of voice packages for specific dialects of the language, if available. Next to the voice package you wish to download, click the download icon on the right.
  5. Click “OK.”
Screenshot of Macbook System Settings. The window shows a list of languages on the left with corresponding voices in different dialects next to list.

You can now test the language shift in Thorium using the text-to-speech function. Please note that similar to Windows, the number of languages available for download is limited in Mac as well.

Next Steps


Learn About Born-Accessible Ebooks

Introduction to Born-Accessible Ebook Production

Creating born-accessible books in-house requires a commitment to accessibility, and an eagerness to learn. This brief Introduction discusses how a publisher can begin strategizing and planning for this goal.

Subject(s): Ebook Production, Strategic Planning
Resource Type(s): Foundations and Rationale

Preparing a Book for Conversion

Ebook Workflow Guide: In-house Production of Born-Accessible Ebooks

To prepare a book for conversion, with accessibility in mind, the steps covered in Ebook Workflow Guide: In-house Production of Born Accessible Ebooks should be followed (if you use Word and InDesign for your manuscript…

Subject(s): Ebook Production
Resource Type(s): Standards and Best Practices, Step-by-Step

Want to discuss this resource?