Example #1
0
        } // MultilingualText.SafeGetValue

        public static string SafeGetValue(this MultilingualText text, string defaultValue)
        {
            if (text == null)
            {
                return(defaultValue);
            }
            return(text.Value ?? defaultValue);
        } // MultilingualText.SafeGetValue
Example #2
0
        } // MultilingualText[].SafeGetLanguageItem

        public static string SafeGetValue(this MultilingualText text)
        {
            if (text == null)
            {
                return(null);
            }
            return(text.Value);
        } // MultilingualText.SafeGetValue
Example #3
0
 public static Property GetLanguageProperty(string name, MultilingualText text)
 {
     if (text == null)
     {
         return(new Property(name, null));
     }
     if (text.Language == null)
     {
         return(new Property(name, text.Value));
     }
     return(new Property(string.Format("{0} ({1})", name, text.Language), text.Value));
 } // GetLanguageProperty
Example #4
0
 /// <summary>
 ///   Creates a new instance of the <see cref="VJournal"/> class with the default
 ///   values.
 /// </summary>
 public VJournal()
 {
     Id = Guid.NewGuid().ToString();
     Classification = AccessClassification.Public;
     RecurrenceDates = new List<Date>(0);
     ExcludedDates = new List<Date>(0);
     Categories = new TagBag();
     RequestStatuses = new List<RequestStatus>(0);
     Attendees = new List<Attendee>(0);
     Contacts = new List<Contact>(0);
     Attachments = new List<CalendarAttachment>(0);
     Relationships = new List<RelationshipReference>(0);
     Description = new MultilingualText();
 }
        public void GetIndexSugar()
        {
            var greetings = new MultilingualText()
            {
                new Text(english, "hello world"),
                new Text(oz, "g'day mate")
            };

            Assert.AreEqual(greetings[english], greetings.WrittenIn(english));
            Assert.AreEqual(greetings[oz], greetings.WrittenIn(oz));
            Assert.AreEqual(greetings["en-au-sydney"], greetings.WrittenIn("en-AU-SYDNEY"));
            Assert.AreEqual(greetings[kiwi], greetings.WrittenIn(kiwi));
            Assert.AreEqual(greetings["FR"], greetings.WrittenIn("fr"));
            Assert.AreEqual(greetings["FR-cn"], greetings.WrittenIn("fr-CN"));

            var empty = new MultilingualText();
            Assert.AreEqual(empty[english], empty.WrittenIn(english));
        }
        void Snippets()
        {
            #region Hello World
            var greetings = new MultilingualText
            {
                new Text("en", "hello world"),
                new Text("en-AU", "g'day mate"),
                new Text("en-NZ", "cheers"),
                new Text("zh-Hant", "你好")
            };

            // Produces: cheers
            Console.WriteLine(greetings["en-NZ"].Value);

            // Produces: hello world
            Console.WriteLine(greetings["en-US"].Value);

            // Produces: 你好
            Console.WriteLine(greetings["zh-Hant"].Value);
            #endregion
        }
Example #7
0
 /// <summary>
 ///   Creates a new instance of the <see cref="Tag"/> class.
 /// </summary>
 public Tag()
 {
     Description = new MultilingualText();
 }
Example #8
0
 /// <summary>
 ///   Creates a new instance of the <see cref="SeasonalChange"/> class with the
 ///   default values.
 /// </summary>
 protected SeasonalChange()
 {
     Comment = new MultilingualText();
     RecurrenceDates = new List<Date>(0);
 }
Example #9
0
        } // MultilingualText[].SafeGetLanguageItem

        public static string SafeGetValue(this MultilingualText text)
        {
            return(text?.Value);
        } // MultilingualText.SafeGetValue