コード例 #1
0
        /// <summary>
        /// Updates the source.
        /// </summary>
        /// <param name="table">The table.</param>
        public void UpdateSource(translationTextTable table = null)
        {
            List <BibTexEntryTag> _tags = new List <BibTexEntryTag>();

            foreach (var pair in Tags)
            {
                if (table != null)
                {
                    pair.Value.source = table.translate(pair.Value.Value, true);
                }
                _tags.Add(pair.Value);
            }

            Tags.Clear();
            foreach (var t in _tags)
            {
                AddTag(t.Key, t);
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("@" + type + "{" + Key + ",");

            Int32 c = 0;

            foreach (var pair in Tags)
            {
                String format = tagFormatOther;

                if (pair.Key == tagKey_Title)
                {
                    format = tagFormatTitle;
                }

                String line = "";

                if (table != null)
                {
                    line = String.Format(format, pair.Key, pair.Value.source);
                }
                else
                {
                    line = String.Format(format, pair.Key, pair.Value.Value);
                }

                sb.AppendLine(line);

                c++;
                if (c < Tags.Count)
                {
                    sb.Append(",");
                }
            }
            sb.AppendLine("}");

            source = sb.ToString();
        }
コード例 #2
0
 /// <summary>
 /// Processes the source.
 /// </summary>
 /// <param name="table">The table.</param>
 public void ProcessSource(translationTextTable table = null)
 {
     if (table == null)
     {
         return;
     }
     foreach (var pair in Tags)
     {
         pair.Value.Value = table.translate(pair.Value.source);
     }
 }