<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<!-- Add the AJAX API script -->
<script type="text/javascript"
src="http://api.microsofttranslator.com/V1/Ajax.svc/Embed?appId=yourAppId"></script>
<title></title>
</head>
<fieldset>
<legend>Results</legend>
<table>
<tr>
<td>
Easily use the Microsoft Translator AJAX API for efficient website translation
scenarios. Simply copy and paste the JavaScript source into your web page to
gain access to the translation methods. With the translate method you can
translate the entire page or invididual elements asynchronously to and from
any of the supported languages.
</td>
</tr>
<tr />
<tr>
<td>
Try it for yourself, clicking on the flags below will translate this page's
text to the language associated with the selected flags country. Once you've
tried the translation click on the ASPX tab above to see exactly how it's
done through JavaScript.
</td>
</tr>
</table>
</fieldset>
<div style="position: relative; margin-left: 20px;">
<!-- Add the image buttons and click event to the translate method,
parse the correct language variable for the country flags -->
<asp:imagebutton id="btnSpanish" runat="server" imageurl="~/Images/spanish_flag.gif"
onclientclick="translateDisclaimer(spanish);return false;" />
<asp:imagebutton id="btnGerman" runat="server" height="20px" width="30px"
imageurl="~/Images/german_flag.gif"
onclientclick="translateDisclaimer(german);return false;" />
<asp:imagebutton id="btnEnglish" runat="server" height="20px" width="30px"
imageurl="~/Images/english_flag.jpg"
onclientclick="translateDisclaimer(english);return false;" />
</div>
<script type="text/javascript">
// Set the language variables
var currentLanguage = "en";
var spanish = "es";
var german = "de";
var english = "en";
// Call the translate method
function translateDisclaimer(language) {
Microsoft.Translator.translate(document.body, currentLanguage, language);
// Update the current language after translating
currentLanguage = language;
}
</script>