Using Google Translate in C#
See if this works for you
google-language-api-for-dotnet
http://code.google.com/p/google-language-api-for-dotnet/
Google Translator
http://www.codeproject.com/KB/IP/GoogleTranslator.aspx
Translate your text using Google Api's
http://blogs.msdn.com/shahpiyush/archive/2007/06/09/3188246.aspx
Calling Google Ajax Language API for Translation and Language Detection from C#
http://www.esotericdelights.com/post/2008/11/Calling-Google-Ajax-Language-API-for-Translation-and-Language-Detection-from-C.aspx
Translation Web Service in C#
http://www.codeproject.com/KB/cpp/translation.aspx
Using Google's Translation API from .NET
http://www.reimers.dk/blogs/jacob_reimers_weblog/archive/2008/06/18/using-google-s-translation-api-from-net.aspx
C# Google translate without api and with unicode
If you check the header section of the returned HTML you will see that it uses charset "windows-1251" - which is specifically for the Cyrillic characters. You need to set the encoding for that.
There may be better ways to get header information prior to downloading the page, but if you are happy to download the page twice - then you could check the charset used & if it is "windows-1251", then change the encoding & download again.
Something like :
string result = webClient.DownloadString(url);
if (result.Contains("windows-1251"))
{
webClient.Encoding = System.Text.Encoding.GetEncoding("windows-1251");
result = webClient.DownloadString(url);
}
else if (result.Contains("ISO-8859-2"))
{
webClient.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-2");
result = webClient.DownloadString(url);
}
you may want to modify it to ensure that the "windows-1251" is in the header section
Language Translation API C#
Two mainstream options are
the Microsoft API, this is free to a certain limit
the Google API is a paid service
An cheap and dirty option would be to call the Google translate directly via a HTTP request (in another words screen scrape the Google translate page) with the new ASP.NET Web API its quite easy to do HTTP requests elegantly. eg: to translate the English phrase "test this" from English to French you need the below URL.
http://translate.google.com/#en/fr/test%20this
Here is the asp.net web api resource.
Converting strings in c# from google translate
Somehow, Google doesn't respect the ie=UTF8
query parameter. We need to add some headers to our request so that UTF8 is returned:
WebClient webClient = new WebClient();
webClient.Encoding = System.Text.Encoding.UTF8;
webClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0");
webClient.Headers.Add(HttpRequestHeader.AcceptCharset, "UTF-8");
Related Topics
Getting the Thread Id from a Thread
C# 6.0 Features Not Working with Visual Studio 2015
Setting the User-Agent Header for a Webclient Request
Cannot Step into .Net Framework Source Code
How to Calculate Wpf Textblock Width for Its Known Font Size and Characters
How to Determine a Mapped Drive's Actual Path
Redirecting Standard Input of Console Application
How to Generate .Net 4.0 Classes from Xsd
Where Is the Wpf Timer Control
Does Anyone Still Use [Goto] in C# and If So Why
File I/O with Streams - Best Memory Buffer Size
Newtonsoft.JSON Cannot Convert Model with Typeconverter Attribute
How to Handle Click Event in Button Column in Datagridview
How to Check a Input Ip Fall in a Specific Ip Range
Implementing Zero or One to Zero or One Relationship in Ef Code First by Fluent API