Closed GoogleCodeExporter closed 8 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
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
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
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
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
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
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
Original issue reported on code.google.com by
Saller....@gmail.com
on 28 Jan 2012 at 7:43