RE: Recommendation for xml:lang expressions

It is not obvious that VXML would want to redefine xml:lang directly since that comes from the XML specification directly (hence the xml namespace prefix).  See http://www.w3.org/TR/REC-xml/#sec-lang-tag for more on that.

Obviously VXML could define something like xmllangexpr attribute and have it defined to evaluate to an string which should then be interpreted as xml:lang, but that could be a little messy IMO.

There are a few different approaches that could be taken to solve your issue, including the if method you call out.  Other methods include:


-           using a server side solution and sending the TTS and language information to the server in an audio URL and having the server render the TTS for you into a normal audio file.

-          (platform extension) defining a VXML property to be the xml:lang on SSML fragments and/or default voice.  Using that property tag to set the language for your program.

-          (spec extension) allowing the value expr to write XML tags as well as text so the <value expr="'&lt;s xml:lang=\"' + callerXmlLang + '\"&gt;$' + thisAmount +'&lt;/s%gt;'"/> or some such similar string.  This was traditionally a feature request (using value to write SSML fragments and/or using value to write SRGS fragments) but for various reasons and much discussion it was generally decided that this sort of document.write like functionality was inappropriate in VXML 2.0/2.1.

From: David Wright [mailto:David.Wright@OntarioSystems.com]
Sent: Wednesday, May 21, 2014 11:45 AM
To: www-voice@w3.org
Subject: Recommendation for xml:lang expressions

In a VXML script, I prompt the caller for language and get a result from a <field>.  I need a way to programmatically express to all additional <audio> tags in my application that the language selected by my caller (let's say 'es') is to be used for TTS.  The <s xml:lang='es'> works if I wanted to hand-code this stuff and have <if> blocks all over the place to see what language to play the audio in, but I'm too lazy to do this much work.  I would really like to have a new attribute in the <s>, <p> and <voice> tags that lets me pass an ecmascript expression that is evaluated and placed into the xml:lang property before sending it over to the SSML engine.

As it is right now, in order to read a dollar amount in either Spanish or English, depending on what the caller chose, I have to do this:

<if cond="callerXmlLang == 'es'">
       <prompt>
              <s xml:lang="es">
                     <value expr="'$' + thisAmount"/>
              </s>
       </prompt>
</if>
<if cond="callerXmlLang == 'en'">
       <prompt>
              <s xml:lang="en">
                     <value expr="'$' + thisAmount"/>
              </s>
       </prompt>
</if>

I also considered using javascript to change the xml:lang attribute on the <vxml> tag, but this would be painful to have to set within every <form> that is called via <subdialog>, since the application context is fresh everytime you use <subdialog>.

[https://no-cache.hubspot.com/cta/default/159435/96c76b68-b911-464a-b811-210d8e4954c1.png]<http://tinyurl.com/ndzpd5y>
Join Ontario Systems at PowerUp 2014. Visit the website and register today.  Register today<http://tinyurl.com/qz6a57q>.
  

Received on Tuesday, 27 May 2014 19:02:22 UTC