Pman.GoogleTranslate.js
[Pman.Core] / Pman.GoogleTranslate.js
index 43616b4..d6a153a 100644 (file)
@@ -31,7 +31,8 @@ Pman.GoogleTranslate = function(str, src, dest, cb, force) {
                 },
                 failure : function() {
                     Roo.log("Google key fetch failed");
-                    
+                    // do not display error message...
+                    return true;
                 }
                 
                 
@@ -129,7 +130,29 @@ Pman.GoogleTranslate = function(str, src, dest, cb, force) {
         if (src  == 'zh-HK')  src = 'zh-TW';
         if (dest == 'zh-HK') dest = 'zh-TW';
      
-         
+        new Pman.Request({
+            url : baseURL + '/Roo/GoogleTranslate.php',
+            method :'POST',
+            mask : 'Translating',
+            maskEl : document.body,
+            params : {
+                text : str,
+                src  : src,
+                dest : dest,
+            },
+            success: function(o)
+            {
+                if (!o.data) {
+                        return o;
+                    }
+//                Roo.MessageBox.alert("Success", "We logged in OK")
+                return o.data.translations[0].translatedText;
+            },
+            failure: function (res) {
+                Roo.log(res);
+                Roo.MessageBox.alert("Failure", "Failed?")
+            }
+        });
         
         x.load(
             {