public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            base.ProcessParagraphUnit(paragraphUnit);
            if (paragraphUnit.IsStructure)
            {
                return;
            }

            var segmentPairs = paragraphUnit.SegmentPairs.ToList();

            var segmentVisitor = new SegmentVisitor(ItemFactory, PropertiesFactory, _patterns, _encryptionKey, _arePatternsEncrypted);

            if (segmentPairs.Count == 0 && paragraphUnit.Source != null)
            {
                segmentVisitor.ReplaceText(paragraphUnit.Source);
            }
            else
            {
                foreach (var segmentPair in segmentPairs)
                {
                    segmentVisitor.ReplaceText(segmentPair.Source);
                    if (segmentPair.Target != null)
                    {
                        segmentVisitor.ReplaceText(segmentPair.Target);
                    }
                }
            }
        }
Beispiel #2
0
 public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
 {
     base.ProcessParagraphUnit(paragraphUnit);
     if (paragraphUnit.IsStructure)
     {
         return;
     }
     foreach (var segmentPair in paragraphUnit.SegmentPairs.ToList())
     {
         var segmentVisitor = new SegmentVisitor(_patterns, _encryptionKey, _arePatternsEncrypted);
         segmentVisitor.ReplaceText(segmentPair.Source, ItemFactory, PropertiesFactory);
         if (segmentPair.Target != null)
         {
             segmentVisitor.ReplaceText(segmentPair.Target, ItemFactory, PropertiesFactory);
         }
     }
 }