Open GoogleCodeExporter opened 8 years ago
Issue 10
http://code.google.com/p/google-api-for-dotnet/issues/detail?id=10&can=1
Original comment by iron9li...@gmail.com
on 25 Oct 2009 at 2:32
Hello, but text length less than 5000 characters (it is 489) =)
I have investigated this situation...Maybe you can use some analogue for
javascript
XMLHttpRequest object? Is it possible?
BR, spassm.
Thanks for the good lib.
Original comment by spa...@gmail.com
on 25 Oct 2009 at 5:51
The test case code true url are shown below.
The only reasen I think is "Request-URI Too Large", no matter how long it is.
I've tried translate it without the last line, it's ok.
To run the js engine with .NET is not impossible, and it seems not too bad.
But it will change a lot(the whole fx). And I do not have enough time playing
this.
If you wanna try it, pls let me know.
Best regards
IL
var text = "Что касается require-mppe - эта опция
необходима для подключения к" +
"VPN-серверу используя 128-битное шифрование. Возможно у вас отсутвует" +
"модуль ядра необходимый для её работы. Попробуйте /sbin/modprobe ppp_mppe" +
"или заменить её на require-mppe-128 (в некоторых портах она так" +
"называлась). Если не получится разобраться с шифрованием, замените адрес" +
"vpn.qline.by на insec-vpn.qline.by (но в таком случаи, сохранность ваших" +
"паролей и данных отправляемых внутири ppp-тоннеля не гарантируется).";
string from;
var translated = this.Client.TranslateAndDetect(text, Language.English, out
from);
Console.WriteLine(translated);
http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=%d0%a7%d1%82
%d0%be+%d0%ba%d0%b0%d1%81%d0%b0%d0%b5%d1%82%d1%81%d1%8f+require-mppe+-+%d1%8d%d1
%82%d0%b0+%d0%be%d0%bf%d1%86%d0%b8%d1%8f+%d0%bd%d0%b5%d0%be%d0%b1%d1%85%d0%be%d0
%b4%d0%b8%d0%bc%d0%b0+%d0%b4%d0%bb%d1%8f+%d0%bf%d0%be%d0%b4%d0%ba%d0%bb%d1%8e%d1
%87%d0%b5%d0%bd%d0%b8%d1%8f+%d0%baVPN-%d1%81%d0%b5%d1%80%d0%b2%d0%b5%d1%80%d1%83
+%d0%b8%d1%81%d0%bf%d0%be%d0%bb%d1%8c%d0%b7%d1%83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c%d0%b5%d0%bd%d0%b8%d1%82%d0%b5+%d0%b0%d0%b4%d1%80%d0%b5%d1%
81vpn.qline.by+%d0%bd%d0%b0+insec-vpn.qline.by+(%d0%bd%d0%be+%d0%b2+%d1%82%d0%b0
%d0%ba%d0%be%d0%bc+%d1%81%d0%bb%d1%83%d1%87%d0%b0%d0%b8%2c+%d1%81%d0%be%d1%85%d1
%80%d0%b0%d0%bd%d0%bd%d0%be%d1%81%d1%82%d1%8c+%d0%b2%d0%b0%d1%88%d0%b8%d1%85%d0%
bf%d0%b0%d1%80%d0%be%d0%bb%d0%b5%d0%b9+%d0%b8+%d0%b4%d0%b0%d0%bd%d0%bd%d1%8b%d1%
85+%d0%be%d1%82%d0%bf%d1%80%d0%b0%d0%b2%d0%bb%d1%8f%d0%b5%d0%bc%d1%8b%d1%85+%d0%
b2%d0%bd%d1%83%d1%82%d0%b8%d1%80%d0%b8+ppp-%d1%82%d0%be%d0%bd%d0%bd%d0%b5%d0%bb%
d1%8f+%d0%bd%d0%b5+%d0%b3%d0%b0%d1%80%d0%b0%d0%bd%d1%82%d0%b8%d1%80%d1%83%d0%b5%
d1%82%d1%81%d1%8f).&langpair=%7cen
Original comment by iron9li...@gmail.com
on 27 Oct 2009 at 2:25
Good time of day)
I found solution for problem with URL length.
Please see example code below:
from - http://alexsnet.ru/2009/02/google-translate-non-ajax-api/
public String TestTranslate(String text, String from, String to)
{
String url = "http://www.google.com/translate_a/t?client=t&sl=" + from + "&tl=" + to;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = "Mozilla/5.0";
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "deflate");
request.Method = WebRequestMethods.Http.Post;
String postContent = String.Format("text={0}", text);
byte[] postBytes = Encoding.UTF8.GetBytes(postContent);
request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(postBytes, 0, postBytes.Length);
requestStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String translatedText = new StreamReader(response.GetResponseStream()).ReadToEnd();
return translatedText;
}
I hope that it should help for you.
BR,
spassm.
Original comment by spa...@gmail.com
on 15 Nov 2009 at 2:34
I will try this in the next version(v0.4).
Original comment by iron9li...@gmail.com
on 26 Feb 2010 at 2:39
It's an unofficial API, I need more details.
Original comment by iron9li...@gmail.com
on 22 Mar 2010 at 4:07
I think, that could give answer for this question only Google... =)
Original comment by spa...@gmail.com
on 22 Mar 2010 at 4:13
Issue 37 has been merged into this issue.
Original comment by iron9li...@gmail.com
on 24 Mar 2010 at 1:35
Issue 40 has been merged into this issue.
Original comment by iron9li...@gmail.com
on 9 Apr 2010 at 8:14
Well you can go around by breaking the string in smaller parts ( I used 400
chars ) translate each (in a loop of some kind maybe)and then sum them up
Original comment by valeriu....@gmail.com
on 1 Sep 2010 at 9:44
Original issue reported on code.google.com by
spa...@gmail.com
on 24 Oct 2009 at 11:06