By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,441 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

help me with one google translate question

P: 1
hi there,

I have one big problem with my translator site. It works great since 1 month ago... Now, I have a problem with it, everything I wrote, they say 'error translating'. I think that google modify some things on APIs...

So, my problem:

I have this code:

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT type="text/javascript" src="http://www.google.com/jsapi"></SCRIPT>
  2. <SCRIPT type="text/javascript">
  3. google.loader.ApiKey='ABQIAAAAnvi2UVNIq_80BAVD4Y4FGBRnHh2_6MU_2gGD9TKVUdKuJciOfRTwWuHk5M_Vqv-4A948HHgFTnsL6Q';
  4. google.load('language','1');
  5. google.setOnLoadCallback(init);
  6. function init()
  7.     {
  8.     document.getElementById('done').disabled=true;
  9. }
  10. function del()
  11.     {
  12.     document.getElementById('text').value='';
  13.     document.getElementById('done').value='';
  14. }
  15. function SubmitKey(text)
  16.     {
  17.     text=text.substring(0,512);
  18.     var src=document.getElementById('src').value;
  19.     var dst=document.getElementById('dst').value;
  20.     document.getElementById('done').disabled=false;
  21.     google.language.translate(text,src,dst,function(res)
  22.         {
  23.         if(!res.error) 
  24.         document.getElementById("done").value=res.translation;
  25.         else 
  26.         document.getElementById("done").value='Error Translating';
  27.     }
  28.     )
  29. }</SCRIPT>
  30.  
  31.  
  32.  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAOjTDkgSN4mqLWcSGv01YxRROwYgObTE6AqUp4nNCDsyrn4uqmhT9GaAxxiKKIISBj-9Gm7tlemyC6Q" type="text/javascript"></script>
  33.  
  34.     <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
  35.  
  36.     <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
  37.  
  38.     <script type="text/javascript">
  39.  
  40.     function initialize() {
  41.       if (GBrowserIsCompatible()) {
  42.  
  43.         // Create and Center a Map
  44.         var map = new GMap2(document.getElementById("map_canvas"));
  45.         map.setCenter(new GLatLng(37.4419, -122.1419), 13);
  46.         map.addControl(new GLargeMapControl());
  47.         map.addControl(new GMapTypeControl());
  48.  
  49.         // bind a search control to the map, suppress result list
  50.         map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHt new GSize(10,20)));
  51.       }
  52.     }
  53.     GSearch.setOnLoadCallback(initialize);
  54.  
  55.     </script>
  56.   <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>


and in body:

Expand|Select|Wrap|Line Numbers
  1. <strong>Original text</strong><br>
  2.             <textarea onkeyup="SubmitKey(this.value)" id="text" name="textarea"></textarea>
  3.                 <br>
  4.             <strong>Language Translator:</strong> 
  5.             <select  id="src" onchange="SubmitKey(document.getElementById('text').value)" name="select">
  6.  
  7.               <option value="sq">Albanian</option>
  8.               <option value="ar">Arabic</option>
  9.               <option value="bg">Bulgarian</option>
  10.               <option value="ca">Catalan</option>
  11.  
  12.  
  13.  
  14.             </select>
  15.  
  16.             </td>
  17.  
  18. <td valign="center" width="10%">
  19.  
  20.  
  21.  
  22. </td>
  23. <td align="center" width="45%">
  24. <strong>Translation</strong><br>
  25. <textarea id="done" disabled="disabled" name="textarea2"></textarea><br>
  26. <strong>In language:</strong> 
  27. <select id="dst" onchange="SubmitKey(document.getElementById('text').value)" name="select">
  28.  
  29.               <option value="sq">Albanian</option>
  30.               <option value="ar">Arabic</option>
  31.               <option value="bg">Bulgarian</option>
  32.             </select>
  33.  
anything I write, script say: 'error translating'

you can see online demo from my site at: translatorul.net/translator_en.php

Thanx alot
Dec 20 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.