Hi,
The SysTrans (http://www.systransoft.com/) documentation discusses the Ajax API and SOAP API, however most of the time for web sites, we want a way to translate all web pages.
The best thing to do is to create a control and add it to the master page. Below is a sample test page used that can be incorporated into any Master Page or Layout.cshtml page for MVC.
I have refrained from using JQuery for the Base64 encoding/decoding as I wanted a solution that does not rely on any external assemblies, of course you can decided to use JQuery and reduce the amount of scripting on the page.
SysTrans will basically send a query to their server when the page loads and it will take your url e.g.
http://mywebsite.com.pages and will then modify it to:
http-mywebsite.com.pages
and then it will Base64 encode the url into a url paramter for paramter name: &systranuid
The best way to see this is to use Fiddler, and see how translation works.
Below is the test page you can use to play with and get a feed. The Encode/Decode code comes directly from the systrans web translation javascript, and is exactly the same as the JQuery library as far as how the algorithm works.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <body> <div class="translate"> Translate this page <div class="selectBox"> <span class="arrow"></span>Change Language <ul> <li><a id="languageLinks0" href="en_fr">French</a> </li> <li><a id="languageLinks1" href="en_de">German</a> </li> </ul> </div> </div> <script type="text/javascript"> window.onload = assignLinksToLanguage; var translationServer = "http://mySysTransServer/turl/?systranprofile=0&systranpopup=0&systranpopupmode=0&systranuid="; function assignLinksToLanguage() { var varLink; var counter = 0; var linkKey = "languageLinks"; varLink = document.getElementById(linkKey + counter); while (varLink != null) { var language = varLink.href.substring(varLink.href.lastIndexOf("/") + 1) var encodedUrl = encodeTranslationSite(language); varLink.href = translationServer + encodedUrl; counter++; varLink = document.getElementById(linkKey + counter); } } function encodeTranslationSite(language) { return encode64(document.URL.replace("://", "-") + "/" + language); } var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function encode64(input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; do { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); } while (i < input.length); return output; } function decode64(input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; // remove all characters that are not A-Z, a-z, 0-9, +, /, or = input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); do { enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } while (i < input.length); return output; } </script> </body> </html>
Hope this gets you started using the Enterprise Version of Systrans.
Any success using the SOAP API and translating an HTML document. We want to migrate to using the Soap API instead of the http url mechanism.