lamaM91 / google-api-for-dotnet

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

Example code does not work #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Calling Translate method with field of Language. ex:
    client.Translate(text, Language.ChineseSimplified, Language.English)

What is the expected output? What do you see instead?

    I got error message telling me that Language can not be convert to 
string.

What version of the product are you using? On what operating system?

    Visual Studio 2010. Windows 7

Please provide any additional information below.
    I have to call Translate method like this:
    string result = trsClient.Translate(text,Language.Unknown,"en");

Original issue reported on code.google.com by iam...@gmail.com on 30 May 2010 at 2:30

GoogleCodeExporter commented 8 years ago
I also experienced this issue.  Perhaps this change is in the works?  I pulled 
the source and that still has the string paramaters.  If you look at the 
Language class in the source code, you can see that it inherit from : 
Enumeration<Language>, where that Enumeration class is defined as 
Enumeration<T> : Enumeration, IEquatable<T>.  I have no idea how to implement 
this, but if you look at the definition of the Language class you can see all 
of the Language definitions with their corresponding values of "en", "de", etc. 
 I'm not sure why they went this route instead of just a ToString(), but I am 
guessing there is some cool reason.

Original comment by wolf.m.s...@gmail.com on 5 Mar 2011 at 7:44