Here my source code :
<html>
<head>
<script type="text/javascript" src="http://www.google.com/
jsapi">
</script>
<script type="text/javascript">
google.load("language", "1");
function initialize(ptext, plang ) {
var text = document.getElementById("translation");;
var lang = plang;
google.language.detect(text, function(result) {
if (!result.error && result.language) {
google.language.translate(text, result.language, "en",
function(result) {
if (result.translation) {
var container = document.getElementById
("translation");
var ptext_trad = result.translation;
return ptext_trad;
}
});
}
});
}
function displayArea()
{
var text = "ordinateur";
var lang = "en";
var text_trad;
text_trad = document.getElementById("translation");
text_trad = initialize(text, lang);
document.write("The area is ", text_trad);
}
</script>
</head>
<body>
<div id="lang">en</div>
<div id="text"></div>
<div id="translation"></div>
<Script Language="JavaScript">
displayArea();
</Script>
</body>
</html>
Thank you for your help.
2009/7/24 Vision Jinx <[email protected]>:
>
> Hi,
>
> I'm not sure I'm entirely following what your asking but you can check
> the docs here >> http://code.google.com/apis/ajaxlanguage/documentation/
>
> Additionally, if you need to assign the translated results to a
> javascript variable you can easily make a JSONP request and work with
> the returned raw JSON data. See here >>
> http://code.google.com/apis/ajaxlanguage/documentation/#fonje
>
> eg. var text=json.responseData.translatedText;
>
>
> On Jul 24, 3:33 am, khay44 <[email protected]> wrote:
>> Hello,
>> I have a criticism of your API translation. Sorry.
>> It is impossible to transfer the result of translation into another
>> variable Javascript. The utlisation and use of this API translation
>> remains very limited.
>> Would vious suggestion so that I can transfer the translation results
>> in a Javascript variable?
>>
>> Thank you for your help.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---