Hi there,
Please advise how to give an option to the user for choosing a language
like press 1 for english 2 for espanol. and there after how the script should look like
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Script for choosing language at beginning
Re: Script for choosing language at beginning
Hi,
There are two pieces when selecting the language. You will need to create a grammar that associates 1 and 2 to English and Spanish and will send this information to the next script.Within the next script (info.php), you will want to capture that GET variable called lang and use it within PHP (or another server-side language) to determine the correct audio files to pull. For example: Hope this helps.
Regards,
Plum Support
There are two pieces when selecting the language. You will need to create a grammar that associates 1 and 2 to English and Spanish and will send this information to the next script.
Code: Select all
<grammar type="application/srgs+xml" root="ROOT" mode="dtmf" maxdigits="1">
<rule id="ROOT">
<one-of>
<item> 1 <tag> SWI_literal="en_us" </tag> </item>
<item> 2 <tag> SWI_literal="es_us" </tag></item>
</one-of>
</rule>
</grammar>
<filled>
<submit next="info.php" namelist="lang" method="get"/>
</filled>
Code: Select all
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>";
$lang = $_GET['lang'];
?>
<vxml version="2.0">
<form id="info">
<block>
<prompt>
<!-- File will play in either English (en_us) or Spanish (es_us) based on $lang -->
<audio src="audio/<?= $lang ?>/information.wav"/>
</prompt>
</block>
</form>
</vxml>
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
Re: Script for choosing language at beginning
In my case, I am not going to hit any web-server to retrieve .wav files, but followed by the language selection any text/prompts in my vxml script should be pronounced in the corresponding language.
Say I have the script........
<?xml version="1.0"?>
<vxml version="2.0">
<form>
<field name="language_id" type="digits?length=1">
<grammar type="application/srgs+xml" root="ROOT" mode="dtmf" maxdigits="1">
<rule id="ROOT">
<one-of>
<item> 1 <tag> SWI_literal="en_us" </tag> </item>
<item> 2 <tag> SWI_literal="es_us" </tag></item>
</one-of>
</rule>
</grammar>
<prompt>
Please choose a language, Press 1 for English, 2 for Spanish.
</prompt>
<filled>
You entered <value expr="language_id"/>.
</filled>
<nomatch>
Invalid Input
<reprompt/>
</nomatch>
<noinput>
Invalid Input
<reprompt/>
</noinput>
</field>
<block>
<goto next="#enter_rider_id"/>
</block>
</form>
<form id="enter_rider_id">
<var name="iTries" expr="0"/>
<field name="id" type="digits?length=6">
<prompt>
Please enter your Rider Identification Number followed by a #
</prompt>
<filled>
<assign name="client_id" expr="id" />
</filled>
</field>
</form>
</vxml>
Based on the language selection 2 the TTS should be changed to spanish (assuming IVR is smart enough to translate English text to Spanish..)
Say I have the script........
<?xml version="1.0"?>
<vxml version="2.0">
<form>
<field name="language_id" type="digits?length=1">
<grammar type="application/srgs+xml" root="ROOT" mode="dtmf" maxdigits="1">
<rule id="ROOT">
<one-of>
<item> 1 <tag> SWI_literal="en_us" </tag> </item>
<item> 2 <tag> SWI_literal="es_us" </tag></item>
</one-of>
</rule>
</grammar>
<prompt>
Please choose a language, Press 1 for English, 2 for Spanish.
</prompt>
<filled>
You entered <value expr="language_id"/>.
</filled>
<nomatch>
Invalid Input
<reprompt/>
</nomatch>
<noinput>
Invalid Input
<reprompt/>
</noinput>
</field>
<block>
<goto next="#enter_rider_id"/>
</block>
</form>
<form id="enter_rider_id">
<var name="iTries" expr="0"/>
<field name="id" type="digits?length=6">
<prompt>
Please enter your Rider Identification Number followed by a #
</prompt>
<filled>
<assign name="client_id" expr="id" />
</filled>
</field>
</form>
</vxml>
Based on the language selection 2 the TTS should be changed to spanish (assuming IVR is smart enough to translate English text to Spanish..)
Re: Script for choosing language at beginning
Hi,
The IVR cannot translate any prompts from English into Spanish. You will need to translate these manually. You would then control the TTS language by using the speak and voice tags. You can see the various controls of these tags within the TTS Speech Engine Characteristics. If you are not going to be using audio files, you will need to maintain two versions of your application. Each version will correlate to the language selected by the user. For example, your code would look more like this:If you're going to play the language selection back to the caller, you will want to play back something they would understand. This example also implicitly uses the AT&T Natural Voices 1.4 TTS Engine.
For maintainability, you may want to create two versions of each script instead of 1 script that contains both languages. Each English script would jump to the other English scripts while Spanish would do the same.
Hope this helps.
Regards,
Plum Support
The IVR cannot translate any prompts from English into Spanish. You will need to translate these manually. You would then control the TTS language by using the speak and voice tags. You can see the various controls of these tags within the TTS Speech Engine Characteristics. If you are not going to be using audio files, you will need to maintain two versions of your application. Each version will correlate to the language selected by the user. For example, your code would look more like this:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form>
<field name="language_id">
<grammar type="application/srgs+xml" root="ROOT" mode="dtmf" maxdigits="1">
<rule id="ROOT">
<one-of>
<item> 1 <tag> SWI_literal="English" </tag> </item>
<item> 2 <tag> SWI_literal="Spanish" </tag></item>
</one-of>
</rule>
</grammar>
<prompt>
Please choose a language, Press 1 for English, 2 for Spanish.
</prompt>
<filled>
You entered <value expr="language_id"/>.
<if cond="language_id == 'English'">
<goto next="#eng_enter_rider_id"/>
<else/>
<goto next="#spa_enter_rider_id"/>
</if>
</filled>
<nomatch>
Invalid Input
<reprompt/>
</nomatch>
<noinput>
Invalid Input
<reprompt/>
</noinput>
</field>
</form>
<form id="eng_enter_rider_id">
<var name="iTries" expr="0"/>
<field name="id" type="digits?length=6">
<prompt>
<speak xml:lang="en_us">
<voice name="Crystal">
Please enter your Rider Identification Number followed by a pound sign.
</voice>
</speak>
</prompt>
<filled>
<assign name="client_id" expr="id" />
</filled>
</field>
</form>
<form id="spa_enter_rider_id">
<var name="iTries" expr="0"/>
<field name="id" type="digits?length=6">
<prompt>
<speak xml:lang="es_us">
<voice name="Rosa">
<!-- This TTS statement must be translated to Spanish for this to properly work. -->
Please enter your Rider Identification Number followed by a pound sign.
</voice>
</speak>
</prompt>
<filled>
<assign name="client_id" expr="id" />
</filled>
</field>
</form>
</vxml>
For maintainability, you may want to create two versions of each script instead of 1 script that contains both languages. Each English script would jump to the other English scripts while Spanish would do the same.
Hope this helps.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com