Interface IParagraphUnit
A continous unit of source language content within a single context, and (if applicable) the localized target language version of the content. This often corresponds to a paragraph of text in a native file.
Inherited Members
Namespace: Sdl.FileTypeSupport.Framework.BilingualApi
Assembly: Sdl.FileTypeSupport.Framework.Core.dll
Syntax
public interface IParagraphUnit : ICloneable
Remarks
There are two types of paragraph units: those that contain localizable content, and those that do not contain localizable content. The latter is referred to as a structure paragraph unit, and typically only contains structure tags and associated whitespace. The IsStructure property indicates whether this paragraph unit is a structure paragraph unit. Since the content of structure paragraph units is not localized, their Target property is null.
Paragraph units that are not structure paragraph units are referred to as localizable paragraph units. They normally have both Source and Target, and never contain structure tags.
The Properties of the paragraph unit contains associated information, including contexts and the paragraph unit's unique id.
The content in localizable paragraph units is typically divided into segments. A segment is usually a sentence. Segments exist in source and target language versions, and you can iterate over them using the SegmentPairs property.
When processing content in a localizable paragraph, it is important to be aware of the fact that the segments do not represent all content of the paragraph. There may also be content between segments. Examples of such content include space characters (which separate sentences), tags that appearr between sentences, etc. Content between segments can differ between the Source and Target.
To iterate over content between segments you can use a Location. The GetSourceSegmentLocation(SegmentId) and GetTargetSegmentLocation(SegmentId) methods can be useful for this task.
The GetSourceSegment(SegmentId) and GetTargetSegment(SegmentId) methods provide a convenient way of locating the corresponding source/target version for a segment.
Properties
IsStructure
true
if this is a structure ParagraphUnit, i.e. a paragraph unit that
contains no localizable content (i.e. structure tags and whitespace only).
Declaration
bool IsStructure { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Properties
Information on this paragraph unit
Declaration
IParagraphUnitProperties Properties { get; set; }
Property Value
Type | Description |
---|---|
IParagraphUnitProperties |
SegmentPairs
Iterator for easy access to the source and target segments in the ParagraphUnit
Declaration
IEnumerable<ISegmentPair> SegmentPairs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISegmentPair> |
Source
Source language content of the ParagraphUnit
Declaration
IParagraph Source { get; set; }
Property Value
Type | Description |
---|---|
IParagraph |
Target
Target language content of the ParagraphUnit
Declaration
IParagraph Target { get; set; }
Property Value
Type | Description |
---|---|
IParagraph |
Methods
GetSegmentPair(SegmentId)
Get the source and target segment with a specified id.
Declaration
ISegmentPair GetSegmentPair(SegmentId id)
Parameters
Type | Name | Description |
---|---|---|
SegmentId | id |
Returns
Type | Description |
---|---|
ISegmentPair |
|
GetSourceSegment(SegmentId)
Returns the segment with the specified id if it exists in the source of this ParagraphUnit.
Declaration
ISegment GetSourceSegment(SegmentId id)
Parameters
Type | Name | Description |
---|---|---|
SegmentId | id |
Returns
Type | Description |
---|---|
ISegment |
|
GetSourceSegmentLocation(SegmentId)
Locates the segment with the specified id inside the source.
Declaration
Location GetSourceSegmentLocation(SegmentId id)
Parameters
Type | Name | Description |
---|---|---|
SegmentId | id | The segment id to search for. |
Returns
Type | Description |
---|---|
Location | Location of the start of the source segment inside the source paragraph, or null if it does not exist. |
GetTargetSegment(SegmentId)
Returns the segment with the specified id if it exists in the target of this ParagraphUnit.
Declaration
ISegment GetTargetSegment(SegmentId id)
Parameters
Type | Name | Description |
---|---|---|
SegmentId | id |
Returns
Type | Description |
---|---|
ISegment |
|
GetTargetSegmentLocation(SegmentId)
Locates the segment with the specified id inside the target.
Declaration
Location GetTargetSegmentLocation(SegmentId id)
Parameters
Type | Name | Description |
---|---|---|
SegmentId | id | The segment id to search for. |
Returns
Type | Description |
---|---|
Location | Location of the start of the target segment inside the target paragraph, or null if it does not exist. |