예제 #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="LocalizableString"/> and properties with data from the source
        /// </summary>
        /// <param name="source">the <see cref="LocalizableStringOccurence"/> with the data</param>
        public LocalizableString(LocalizableStringOccurence source)
        {
            this.Text       = source.Text;
            this.TextPlural = source.TextPlural;
            this.Context    = source.Context;

            this.Locations = new List <LocalizableStringLocation>();
            this.Locations.Add(source.Location);
        }
        protected LocalizableStringOccurence CreateLocalizedString(string text, string textPlural, T node)
        {
            var result = new LocalizableStringOccurence()
            {
                Text       = text,
                TextPlural = textPlural,
                Location   = this.MetadataProvider.GetLocation(node),
                Context    = this.MetadataProvider.GetContext(node)
            };

            return(result);
        }
 /// <summary>
 /// Adds <see cref="LocalizableStringOccurence"/> to the collection
 /// </summary>
 /// <param name="s">the item to add</param>
 public void Add(LocalizableStringOccurence s)
 {
     if (s != null)
     {
         var key = s.Context + s.Text;
         if (_values.TryGetValue(key, out var localizedString))
         {
             localizedString.Locations.Add(s.Location);
         }
         else
         {
             _values.Add(key, new LocalizableString(s));
         }
     }
 }
 public abstract bool TryExtract(T node, out LocalizableStringOccurence result);