Creating Error Pages for Multi-Language Applications
In a multi-language speech application, it is important to play error messages in the user's language. For more information about error pages, see Creating Speech Application Error Pages.
Creating Application Error Pages
The recommended architecture for multi-language applications is to use a chooser application to determine the user's preferred language and branch from there to separate Web applications, with each separate application supporting a single user language.
Assuming this architecture, provide a separate application error page for each language-specific application. In the application error page for each application include a QA control that plays a recorded prompt in the application language. Specify the application error page as described in Creating Speech Application Error Pages.
Creating a System Error Page
The system error page must be able to play prompts in each of the languages supported by Telephony Application Services (TAS), and it must be designed so that it does not rely on external services such as Speech Engine Services (SES) and the Web server. To do this:
- Store the current culture in the CallInfo object in the Start page code-behind of each language-specific application.
- Provide a .wav file containing an error message in that language for each application language.
- Provide an .html file that retrieves the culture information and plays the appropriate .wav file.
These tasks are described in the following sections.
Start Page Code-behind
The first requirement for the system error page is determining the current culture to know which language the error message should play in. In the Start page code-behind of each language-specific application include script that adds the display name of the application culture to an array element in the CallInfo object and then uses the RegisterClientScriptBlock method to add the script to the client page. See the following example.
private void Page_Load(object sender, System.EventArgs e)
{
string scriptString = "<script language=jscript>";
scriptString += " if (typeof(window.clientInformation.callInfo)==\"undefined\")";
scriptString += "{window.clientInformation.callInfo = new Array();}";
scriptString += "window.clientInformation.callInfo[\"ThisCulture\"] = ";
scriptString += "\"French (Canada)\"</";
scriptString += "script>";
if(!Page.IsClientScriptBlockRegistered("CultureInfoScript"))
Page.RegisterClientScriptBlock("CultureInfoScript", scriptString);
}
Error Page
To avoid relying on SES and the Web server, the system error page must be an .html file. Specify the system error page as described in Creating Speech Application Error Pages. Store the system error page on the Web server.
Provide a separate .wav file for each language supported by TAS. Consider also providing an additional generic error message in case the current culture cannot be determined. The .wav file must be 8-kHz mono a-law or mu-law compressed audio depending on the telephony standard of the locale where it is used. For better quality audio, use 8-kHz 16-bit PCM. To play the .wav files, use SALT elements as shown in the following example.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:SALT="http://www.saltforum.org/2002/SALT">
<head>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name=ProgId content=VisualStudio.HTML>
<meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<object id="Speechtags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object>
<?import namespace="salt" implementation="#Speechtags" ?>
<SALT:prompt id="PromptSpanish">
<SALT:content id="PromptContent" href="http://myServer/Spanish.wav" />
</SALT:prompt>
<SALT:prompt id="PromptFrench">
<SALT:content id="PromptContent" href="http://myServer/French.wav" />
</SALT:prompt>
<SALT:prompt id="PromptNoLanguage">
<SALT:content id="PromptContent" href="http://myServer/NoLanguage.wav" />
</SALT:prompt>
<script language=jscript>
function fnOnLoad()
{
if(window.clientInformation.callInfo["ThisCulture"]=="Spanish (Mexico)")
{
PromptSpanish.Start();
}
else if (window.clientInformation.callInfo["ThisCulture"]=="French (Canada)")
{
PromptFrench.Start();
}
else
{
PromptNoLanguage.Start();
}
}
</script>
</head>
<body onload="fnOnLoad()">
</body>
</html>
Conclusion
In multi-language applications, each language-specific Web application can provide its own application error page, using a QA control to play a recorded prompt in the appropriate language. For system error pages, because there is only one for each TAS and it must be an .html file, use a script to determine the current culture and play a .wav file containing an error message in the appropriate language.
See Also
Creating Speech Application Error Pages | Creating Speech-Enabled Web Pages