hungvi122 / google-language-api-for-dotnet

Automatically exported from code.google.com/p/google-language-api-for-dotnet
0 stars 0 forks source link

Google Translate API for .Net is not working #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. I have tried to create a simple test application with textbox as Input 
and Label as output
2. On Button click event I have following code.
protected void btnTranslateIt_Click(object sender, EventArgs e)
        {
            string Text = txtInput.Text;            
            Text = 
Google.API.Translate.Translator.Translate(Text,Google.API.Translate.Languag
e.English, 
Google.API.Translate.Language.French,Google.API.Translate.TranslateFormat.t
ext);
            lblOutput.Text = Text;            
        }

3. When I copied artile from website and tried to paste to see how it 
translate it was giving exception.

In above code, I tried both Format "Text" and "Html" while writing code.  I 
even tried to translate without explicitly passing format parameter but 
none of them worked.

What version of the product are you using? On what operating system?
GoogleTranslateAPI_0.1.zip. and OS - Win. XP

Following is exception details
Google.API.Translate.TranslateException was unhandled by user code
  Message="Translate failed!"
  Source="GoogleTranslateAPI"
  StackTrace:
       at Google.API.Translate.Translator.Translate(String text, Language 
from, Language to, TranslateFormat format)
       at GoogleTranslate._Default.btnTranslateIt_Click(Object sender, 
EventArgs e) in 
C:\MyStuff\Practise\GoogleTranslate\GoogleTranslate\Default.aspx.cs:line 21
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String 
eventArgument)
       at 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaiseP
ostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler 
sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 
postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean 
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: Google.API.Translate.TranslateException

Message="request:\"http://ajax.googleapis.com/ajax/services/language/transl
ate?langpair=en%7Cfr&format?
=text&q=Business+Users+today+have+to+operate+on+tens%2c+if+not+hundreds+of+
applications%2c+as+part+of+their+daily+routine+to+run+through+their+quota+o
f+work%2c+moving+from+one+silo+to+another+to+another%2c+and+if+that+isn%e2%
80%99t+enough%2c+the+increased+application+access+and+password+complexity%2
c+making+it+absolutely+hard+to+maintain+focus+on+their+core+jobs.+Add+to+th
at%2c+a+lack+of+interoperability+between+these+systems%2c+and+a+lack+of+a+t
ruly+integrated+experience%2c+and+you%e2%80%99ve+just+defined+virtual+hell.
+Not+to+mention%2c+the+virtual+nightmare+that+it+is%2c+for+the+IT+departmen
ts%2c+to+manage+and+maintain+these+varied+platforms+and+applications+on+a+d
ay+to+day+basis.%0d%0a+%0d%0aIn+a+world+where+the+focus+has+moved+from+%e2%
80%9c+one+solution+for+all+%e2%80%9c+to+%e2%80%9cdoing+one+thing%2c+and+doi
ng+it+right%e2%80%9d%2c+vendors+are+building+software+solutions+that+meet+s
ome+specific+need+and+Enterprises%2c+in+an+attempt+to+stay+current%2c+and+t
o+give+their+employees+the+best-of-the-
breed+software+end+up+bringing+in+a+myriad+of+applications+and+platforms+wi
thin+their+environments.+The+result%3a+%e2%80%9cVirtual+Hell%e2%80%9d.%0d%0
a+%0d%0aPositioning+of+SharePoint+as+a+Business+Platform%0d%0a+%0d%0aShareP
oint+Features+and+Benefits%0d%0a+%0d%0aProvides+out+of+the+box+collaboratio
n+features+like+blogs%2c+wikis%2c+discussions%2c+project+management%2c+docu
ment+libraries%2c+lists+etc.%2c+that+are+easy+to+use+and+allow+information+
workers+to+share+and+manage+contents.%0d%0aAllows+building+applications+tha
t+are+supportable%2c+extensible+and+easily+maintainable+by+business+users%0
d%0aWorkspace+templates+along+with+the+collaboration+tools+can+be+used+to+m
anage+specific+information+about+projects%2c+IT%2c+HR+etc.%2c%0d%0aAdvanced
+Document+management+capabilities+with+support+of+content+types+allow+infor
mation+workers+to+easily+create+documents%2c+fill+information+and+share+the
m+securely.%0d%0aCan+be+a+single+platform+for+Intranet%2c+Extranet+and+Inte
rnet+with+support+for+hosting+to+provide+applications+and+software+as+servi
ce%0d%0aSupports+collaboration+both+within+the+internal+users%2c+external+u
sers%2c+and+anonymous+users+of+the+Enterprise.%0d%0aSupports+out+of+the+box
+reporting+dashboards%2c+KPI+web+parts+etc.+that+can+be+used+to+build+mash+
ups+and+integration+with+backend+systems%0d%0aOffers+a+component%2c+the+Bus
iness+Data+Catalog+that+allows+for+integration+of+LOB+systems+with+SharePoi
nt%2c+and+surfacing+the+data+from+within+these+disparate+systems%2c+right+i
nto+SharePoint.%0d%0a+%0d%0a+%0d%0aSharePoint+is+a+great+platform+for+build
ing+robust+and+flexible+Enterprise+2.0+solutions+that+are+extensible+and+se
cure%2c+and+leverage+Web+2.0+in+a+holistic+fashion+to+empower+business+user
s%2c+and+help+organizations+become+more+agile%2c+efficient+and+productive%2
c+all+in+a+seamless+and+secure+fashion.+Common+areas+where+Enterprise+2.0+s
olutions+prove+particularly+useful+are+IT+helpdesk%2c+Active+Directory+user
+provisioning+and+profile+management%2c+eProcurement+and+the+like.+Well+des
igned+Enterprise+2.0+solutions+virtually+become+key+strategic+assets+for+an
y+organization%e2%80%99s+business+performance.%0d%0a%0d%0aAbout+OptimusBT%2
c%0d%0a%0d%0aOptimusBT+Microsoft+Gold+Certified+Partner+is+a+global+leader+
in+providing+Business+solutions+that+are+primarily+sharepoint+based+and+uti
lize+existing+client+infrastructure.+For+over+5+years%2c+OptimusBT+has+pave
d+the+road+when+implementing+complex%2c+global+sharepoint+solutions+in+the+
areas+of+Sales%2c+Finance%2c+Procurement%2c+Manufacturing%2c+Human+Resource
s%2c+and+others+across+industry+segments+around+the+world.&v=1.0\""
       Source="GoogleTranslateAPI"
       StackTrace:
            at Google.API.Translate.Translator.Translate(String text, 
String from, String to, TranslateFormat format)
            at Google.API.Translate.Translator.Translate(String text, 
Language from, Language to, TranslateFormat format)
       InnerException: Google.API.GoogleAPIException
            Message="Failed to get response."
            Source="GoogleTranslateAPI"
            StackTrace:
                 at Google.API.RequestUtility.GetResponseData[T](WebRequest 
request)
                 at Google.API.Translate.Translator.Translate(String text, 
String from, String to, TranslateFormat format)
            InnerException: System.Net.WebException
                 Message="The remote server returned an error: (414) 
Request-URI Too Large."
                 Source="System"
                 StackTrace:
                      at System.Net.HttpWebRequest.GetResponse()
                      at 
Google.API.RequestUtility.GetResponseData[T](WebRequest request)
                 InnerException: 

Original issue reported on code.google.com by dotnetg...@gmail.com on 18 May 2010 at 3:14

GoogleCodeExporter commented 8 years ago
i have the same issue if you find any solution please forward that one to me my 
mail id is

sharanraj.n@gmail.com

Original comment by sharanra...@gmail.com on 4 Nov 2010 at 11:49

GoogleCodeExporter commented 8 years ago
The issue appears to be that this library is still using GET instead of POST, 
and GET calls have some sort of unpredictable limit to the text length. I 
reported this issue last year. You have to translate smaller strings as 
separate calls and then concat them together, which is a real pain in the butt.

Original comment by richard....@gmail.com on 2 Dec 2010 at 7:23

GoogleCodeExporter commented 8 years ago
I am having the same issue. if anyone know the solution email me.

Original comment by mamin%eo...@gtempaccount.com on 25 Mar 2011 at 3:24

GoogleCodeExporter commented 8 years ago
Any news about this?

Original comment by KimSojbo...@gmail.com on 21 Jul 2012 at 9:12