Megabytemb / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Language cannot be returned by GoogleContactsAPI #570

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. There is a property "Language" on Google Contact, but this field cannot be 
set in GoogleMail Contacts
2. And if you try to return or set this field thru the Language property, it 
doesn't have any effect

What is the expected output? a Language field existing in Google and set and 
get by the Language property

What do you see instead? Language is always null, even if set before

What version of the product are you using?
GoogleData API 1.9 (released in September 2011
On what operating system? Win7

Original issue reported on code.google.com by Saller....@gmail.com on 28 Jan 2012 at 7:43

GoogleCodeExporter commented 9 years ago
The current version of the library doesn't expose Contact.Languages, but you 
can still get the same property by accessing Contact.ContactEntry.Languages.
However, I just submitted rev. 1150, which allows you to set and get the 
languages as follows:

RequestSettings settings = new 
RequestSettings("GoogleInc-TestContactsLanguage", "username", "password");
ContactsRequest cr = new ContactsRequest(settings);

Contact newEntry = new Contact();
newEntry.Name = new Name() {
    FullName = "Test Language",
    GivenName = "Test",
    FamilyName = "Language",
};

newEntry.Languages.Add(new Language() { Code = "zh_cn" });
newEntry.Languages.Add(new Language() { Label = "Italian" });

Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));
Contact createdEntry = cr.Insert(feedUri, newEntry);
Console.WriteLine("Contact's ID: " + createdEntry.Id);
foreach (Language language in createdEntry.Languages) {
    Console.WriteLine(language.Code ?? language.Label);
}

Original comment by ccherub...@google.com on 30 Jan 2012 at 6:17

GoogleCodeExporter commented 9 years ago
But what if I don't care about the ContactEntry.Languages and am interested in 
Contact.Language (or ContactEntry.Language)? This is just a string that can be 
set (e.g. to "English" or "German") and I can use it to sync with Outlook's 
contact language property

Original comment by Saller....@gmail.com on 14 Feb 2012 at 7:15

GoogleCodeExporter commented 9 years ago
ContactEntry.Languages is just an accessor property to allow developers to get 
all values of the repeated gContact:language field:

http://code.google.com/apis/contacts/docs/3.0/reference.html#gcLanguage

The string you are talking about is the Label property of the Language field.

Original comment by ccherub...@google.com on 14 Feb 2012 at 7:42

GoogleCodeExporter commented 9 years ago
Ok, I understood that I can use the ContactEntry.Languages. But why is there a 
Contact.Language property? What is it used for?

Original comment by Saller....@gmail.com on 14 Feb 2012 at 8:51

GoogleCodeExporter commented 9 years ago
Are you talking about the Language property in atombase.cs? That is used for 
the xml:lang value which is a standard ATOM element used for 
Internationalization:

http://en.wikipedia.org/wiki/Atom_(standard)

If you are talking about something else, please link me to the code where this 
property is defined. 

Original comment by ccherub...@google.com on 14 Feb 2012 at 9:53

GoogleCodeExporter commented 9 years ago
I am talking about the string property exposed by Contact class. Maybe it is 
inherited from AtomEntry? Then I completely missunderstood this ptoperty snd 
will change to the languages property as you proposed. But I have to wait for a 
new Google Api release, because currently I am still usin version 1.9 and you 
just made a change to add languages, right? Do you know, when there will be a 
new release?

Original comment by Saller....@gmail.com on 15 Feb 2012 at 7:19

GoogleCodeExporter commented 9 years ago
I checked it and you are right, the Language attribute comes from AtomBase. I 
switched now to the Languages property and this already working fine with 
Google DataAPI 1.9

Original comment by Saller....@gmail.com on 15 Feb 2012 at 5:24