public ISegmentPair GetSegmentPair(string segmentId, string sourceText, string targetText) { var segmentPairProperties = _segmentBuilder.CreateSegmentPairProperties(); segmentPairProperties.Id = new SegmentId(segmentId); var sourceSegment = _segmentBuilder.CreateSegment(segmentPairProperties); sourceSegment.Properties = segmentPairProperties; sourceSegment.Add(_segmentBuilder.Text(sourceText)); var targetSegment = _segmentBuilder.CreateSegment(segmentPairProperties); targetSegment.Properties = segmentPairProperties; targetSegment.Add(_segmentBuilder.Text(targetText)); var segmentPair = _segmentBuilder.CreateSegmentPair(sourceSegment, targetSegment); return(segmentPair); }
public static IParagraph AddSegment(this IParagraph paragraph, ISegment segment, SegmentBuilder builder) { if (segment != null) { var newSegment = builder.CreateSegment(segment.Properties.Clone() as ISegmentPairProperties); foreach (var item in segment) { newSegment.Add(item?.Clone() as IAbstractMarkupData); } paragraph.Add(newSegment); } return(paragraph); }