FIROZ ANSARI

FIROZ ANSARI

  • NA
  • 52
  • 5.6k

TranslateException

Apr 18 2017 6:21 AM
I am using this .dll file in my article, last year its working perfectly but 
now this is not working and gives error 
Google.API.Translate.TranslateException: Translate failed! So my Blog visiters 
need the solution for this problem. Please help for this problem as soon as 
possible.
Thanks
Using Asp.net

my Source Code is given bellow

using System; 
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.OracleClient; using System.Data; using System.Configuration; using System.Collections; using System.Globalization; using Google.API.Translate; using Newtonsoft.Json; public partial class Language : System.Web.UI.Page {           OracleConnection con = new OracleConnection();           OracleCommand cmd;     protected void Page_Load(object sender, EventArgs e)     {        if (Page.IsPostBack == false)         {             bind_lbl();         }     }     protected void btnSave_Click(object sender, EventArgs e)     {         //con.ConnectionString = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;         //con.Open();         //OracleCommand cmd = new OracleCommand();         //cmd.CommandText = "insert into abc values(@detail)";         //cmd.Connection = con;         //cmd.Parameters.AddWithValue("@detail",txt_msg.Text);         //cmd.ExecuteNonQuery();         //cmd.Dispose();         //con.Close();         //bind_lbl();      }      private void bind_lbl()     {         try         {             con.ConnectionString = ConfigurationManager.ConnectionStrings["EBSconstr"].ConnectionString;             con.Open();             OracleDataAdapter adp = new OracleDataAdapter("SELECT sno,name,phoneno,address,city,salary,dob FROM ( SELECT sno,name,phoneno,address,city,salary,dob, DENSE_RANK() OVER (ORDER BY salary DESC) sal_dense_rank FROM abc ) WHERE sal_dense_rank <= 1", con);             DataSet ds = new DataSet();             adp.Fill(ds);             adp.Dispose();             String detail1 = Convert.ToString(ds.Tables[0].Rows[0]["sno"]);             String detail2 = Convert.ToString(ds.Tables[0].Rows[0]["name"]);             String detail3 = Convert.ToString(ds.Tables[0].Rows[0]["phoneno"]);             String detail4 = Convert.ToString(ds.Tables[0].Rows[0]["address"]);             String detail5 = Convert.ToString(ds.Tables[0].Rows[0]["city"]);             String detail6 = Convert.ToString(ds.Tables[0].Rows[0]["salary"]);             String detail7 = Convert.ToString(ds.Tables[0].Rows[0]["dob"]);              //Console.WriteLine("Before Translation:{0},{1},{2},{3},{4},{5},{6},{7}", detail1,detail2,detail3,detail4,detail5,detail6,detail7);                          detail1 = Google.API.Translate.Translator.Translate(detail1, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);             detail2 = Google.API.Translate.Translator.Translate(detail2, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);             detail3 = Google.API.Translate.Translator.Translate(detail3, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);             detail4 = Google.API.Translate.Translator.Translate(detail4, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);             detail5 = Google.API.Translate.Translator.Translate(detail5, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);             detail6 = Google.API.Translate.Translator.Translate(detail6, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);             detail7 = Google.API.Translate.Translator.Translate(detail7, Google.API.Translate.Language.English, Google.API.Translate.Language.Arabic);               // below after the laguage. , you can select the language according to your need ,              //Google.API.Translate.Language.Hindi);             //Or             //Google.API.Translate.Language.Arabic);             //Or             //Google.API.Translate.Language.Bulgarian);             //Or             //Google.API.Translate.Language. Catalan);                          lblSno.Text = detail1;             lblname.Text = detail2;             lblmob.Text = detail3;             lbladd.Text = detail4;             lblcity.Text = detail5;             lblsal.Text = detail6;             lbldob.Text = detail7;          }         catch (TranslateException ex)         {             lblSno.Text = ex.Message;         }     }     protected void btncancel_Click(object sender, EventArgs e)     {      }  }

Answers (1)