I want to use tts chrome extensions API to read a text with multiple languages.
I tried this
const english = (await chrome.tts.getVoices()).find(x => x.lang === "en-US").voiceName
const danish = (await chrome.tts.getVoices()).find(x => x.lang === "da-DK").voiceName
await chrome.tts.speak(`
<?xml version="1.0"?>
<speak version="1.0">
<voice name="${danish}">
Jeg er glad for at se dig
</voice>
<voice name="${english}">
I'm good to see you
</voice>
</speak>
`);
But it reads both texts as English texts.
It might have to do with
document fragmentation. I also tried this using the back-tick same way as you're doing and it uttered all the words even the tags, attributes, question marks of xml. Then I changed to this:and it worked.