Rachit95 / google-api-for-dotnet

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

Google Translate API for .NET 0.4 alpha - Translate function: argument list error #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. In .Net 3.5 after unzipping the 0.4 version package i add the required 
dlls.
2. I write the following code in C# (given as a sample).
string text = "我喜欢跑步。";
TranslateClient client = new TranslateClient("www.google.com");
string translated = client.Translate(text, Language.ChineseSimplified, 
Language.English);
Console.WriteLine(translated);

What is the expected output? What do you see instead?
The expected outcome is the translation of the Chinese text into Englis 
i.e. "I like running"
Instead I get the error that Translate function takes 2nd & 3rd argument 
as string ojects. I have checked out the documentation & that really is 
the case. However i cannot seem to find any way to convert Language class 
object to string class object.

What version of the product are you using? On what operating system?
I am using .Net SP1 & Google Translate API for .NET 0.4 alpha. The OS is 
windows professional 7 (32 bit).

Please provide any additional information below.
I have done the same using 0.2 version of the API. It works there since 
the translate function takes the 2nd & 3rd arguments as Language objects & 
not as strings. 

Original issue reported on code.google.com by sadi...@gmail.com on 14 May 2010 at 11:26

GoogleCodeExporter commented 8 years ago
Hi sadiash,

Google.API.Search.Language.ChineseSimplified can convert to string implicitly.

You can try v0.3.1 if v0.4alpha not works.

Original comment by iron9li...@gmail.com on 16 May 2010 at 7:13

GoogleCodeExporter commented 8 years ago
GoogleTranslateAPI_0.4_alpha.zip does not work because missing cast operator in 
Language.cs add 
 public static implicit operator string(Language value)
        {
            return value.Value;
       }
at 599 line in Language.cs to fix this

Original comment by Chupak...@gmail.com on 20 May 2010 at 7:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Can you help me?
i add the required dlls and "using Google.API.Translate;"
A TypeLoadException appeared
"The version of the assembly System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089 cannot be loaded by this version of the 
Microsoft
.NET Compact Framework."
i'm using .Net Compact Framework 3.5 and GoogleTranslateAPI.Compact.dll,
Newtonsoft.Json.Compact.dll

Original comment by trantien...@gmail.com on 21 May 2010 at 4:15

GoogleCodeExporter commented 8 years ago
Thank you, Chupakabr! I'll fix it asap.

trantiendat1508, Can you add a new issue for it?

Original comment by iron9li...@gmail.com on 25 May 2010 at 6:30

GoogleCodeExporter commented 8 years ago
No, Chupakabr.
I've the implicit operator in super class Enumeration.
http://code.google.com/p/google-api-for-dotnet/source/browse/trunk/src/Core/Enum
eration.cs#116

It must be something wrong about ILMerge.

Original comment by iron9li...@gmail.com on 25 May 2010 at 6:36

GoogleCodeExporter commented 8 years ago
i have the same problem 

Error   1   Cannot implicitly convert type 'Google.API.Translate.Language' to 
'string'    C:\Users\...
 2010\Projects\First\First\Form1.cs 34  30  First

Original comment by Al.Waz...@gmail.com on 12 Aug 2010 at 3:01

GoogleCodeExporter commented 8 years ago
Any help on this error? I also have the same as above.

Original comment by 9000r...@gmail.com on 29 Sep 2010 at 7:39

GoogleCodeExporter commented 8 years ago
I had the same error ("[response status:400]invalid translation language 
pair"). I found that replacing the "Language..." parameters with their string 
equivalents fixed the error. As I was translating from russian to english, I 
used the following:

string translated = client.Translate(GetOriginalText(hncRow), "ru", "en")

Its working beautifully now :)

Original comment by kfhas...@gmail.com on 25 Oct 2010 at 7:54

GoogleCodeExporter commented 8 years ago
client.Translate(text, "zh_CN", "en");

It's may be problem with ISO codes, you can still use it with valid ISO codes.

Original comment by gamesugg...@gmail.com on 28 Oct 2010 at 4:20

GoogleCodeExporter commented 8 years ago
Hi 
I am sorry if its a wrong post here but I need some help if possible 

I want to translate from Urdu to English 

anychance anyone could help me with that will be great

Many Thanks

Original comment by miles2sm...@gmail.com on 13 Dec 2010 at 5:05

GoogleCodeExporter commented 8 years ago

            string Text = textBox1.Text;
            TranslateClient client = new TranslateClient("");
            string targetLanguage ="en";
            string translatedValue = client.Translate(Text,"en", targetLanguage);
            textBox2.Text = translatedValue;

i cannot see the hindi font?

Original comment by ashwanth...@gmail.com on 14 Jun 2011 at 11:06