Search Results for

    Show / Hide Table of Contents

    Class TranslationUnit

    Represents a pair of source and target text, decorated with a set of system fields and eventually, with a set of user defined fields/attributes. It may also contain contextual information as well as information about its origin and eventually, a key for unique identification on a given system.

    Inheritance
    System.Object
    PersistentObject
    TranslationUnit
    Implements
    ITypedKeyValueContainer
    Inherited Members
    PersistentObject.ResourceId
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.TranslationMemory
    Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
    Syntax
    public class TranslationUnit : PersistentObject, ITypedKeyValueContainer

    Constructors

    TranslationUnit()

    Initializes a new instance of the TranslationUnit class. The system fields are initialized to their default values, the user defined fields as well as the context list are initialized to empty lists.

    Declaration
    public TranslationUnit()

    TranslationUnit(Segment, Segment)

    Initializes a new instance of the TranslationUnit class with the specified values. The system fields are initialized to their default values, the user defined fields as well as the context list are initialized to empty lists.

    Declaration
    public TranslationUnit(Segment sourceSegment, Segment targetSegment)
    Parameters
    Type Name Description
    Segment sourceSegment

    The source segment

    Segment targetSegment

    The target segment

    TranslationUnit(TranslationUnit)

    Initializes a new instance of the TranslationUnit class from another instance (deep copy).

    Declaration
    public TranslationUnit(TranslationUnit other)
    Parameters
    Type Name Description
    TranslationUnit other

    The other instance.

    Properties

    AlignmentData

    Declaration
    public LiftAlignedSpanPairSet AlignmentData { get; set; }
    Property Value
    Type Description
    Sdl.Core.FineGrainedAlignment.Core.LiftAlignedSpanPairSet

    AlignModelDate

    The build DateTime of the translation model used to align content in this TU.

    Declaration
    public DateTime? AlignModelDate { get; set; }
    Property Value
    Type Description
    System.Nullable<System.DateTime>

    ConfirmationLevel

    Gets or sets the confirmation level of this translation unit.

    Declaration
    public ConfirmationLevel ConfirmationLevel { get; set; }
    Property Value
    Type Description
    ConfirmationLevel

    Contexts

    Gets or sets the contexts for this instance.

    Declaration
    public TuContexts Contexts { get; set; }
    Property Value
    Type Description
    TuContexts

    DocumentProperties

    Gets or set the document properties

    Declaration
    public IDocumentProperties DocumentProperties { get; set; }
    Property Value
    Type Description
    IDocumentProperties

    DocumentSegmentPair

    Gets or sets the segment pair associated to this translation unit. The segment pair should not be modified because the modification might change the original document.

    Declaration
    public ISegmentPair DocumentSegmentPair { get; set; }
    Property Value
    Type Description
    ISegmentPair

    FieldValues

    Gets or sets the user-defined field values for this translation unit.

    Declaration
    public FieldValues FieldValues { get; set; }
    Property Value
    Type Description
    FieldValues

    FileId

    FileId of the bcm document file that holds the segmentPair that generated this translationUnit

    Declaration
    public string FileId { get; set; }
    Property Value
    Type Description
    System.String

    FileProperties

    Gets or set the file properties

    Declaration
    public IFileProperties FileProperties { get; set; }
    Property Value
    Type Description
    IFileProperties

    Format

    Gets or sets the format of this translation unit.

    Declaration
    public TranslationUnitFormat Format { get; set; }
    Property Value
    Type Description
    TranslationUnitFormat

    IdContexts

    stores SID context

    Declaration
    public TuIdContexts IdContexts { get; set; }
    Property Value
    Type Description
    TuIdContexts

    InsertDate

    The DateTime used to determine whether this TU is 'postdated' compared to a translation model. This is usually the time at which the TU was added, unless it's "cloned" from an earlier TU, e.g. in an UpdateTranslationUnits flow that does not change segment content.

    Declaration
    public DateTime? InsertDate { get; set; }
    Property Value
    Type Description
    System.Nullable<System.DateTime>

    Origin

    Gets or sets the origin of this translation unit.

    Declaration
    public TranslationUnitOrigin Origin { get; set; }
    Property Value
    Type Description
    TranslationUnitOrigin

    SourceSegment

    Gets or sets the source segment of this instance.

    Declaration
    public Segment SourceSegment { get; set; }
    Property Value
    Type Description
    Segment

    StructureContexts

    Gets or sets the names of the structure contexts in which this translation unit occured within the documents it originated from.

    Declaration
    public string[] StructureContexts { get; set; }
    Property Value
    Type Description
    System.String[]
    Remarks

    This setting is stored as a multiple string field value with name "StructureContext" in the FieldValues collection.

    SystemFields

    Gets or sets the system fields of this translation unit.

    Declaration
    public SystemFields SystemFields { get; set; }
    Property Value
    Type Description
    SystemFields

    TargetSegment

    Gets or sets the target segment of this instance.

    Declaration
    public Segment TargetSegment { get; set; }
    Property Value
    Type Description
    Segment

    Methods

    CheckAndComputeTagAssociations()

    See CheckAndComputeTagAssociationsAsync()

    Declaration
    [Obsolete("Use CheckAndComputeTagAssociationsAsync")]
    public void CheckAndComputeTagAssociations()

    CheckAndComputeTagAssociationsAndKeepInvalidAlignmentsAsync()

    similar with CheckAndComputeTagAssociations but keeps invalid alignments so tu.validate detects them later and invalidates tu before write to storage

    Declaration
    public Task CheckAndComputeTagAssociationsAndKeepInvalidAlignmentsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    CheckAndComputeTagAssociationsAsync()

    Computes cross-segment tag associations. Primarily checks or changes the tag-related alignment anchors. Renumbers association anchors.

    Declaration
    public Task CheckAndComputeTagAssociationsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    ComputePlaceables()

    Declaration
    [Obsolete("Use ComputePlaceablesAsync")]
    public List<Placeable> ComputePlaceables()
    Returns
    Type Description
    System.Collections.Generic.List<Placeable>

    ComputePlaceablesAsync()

    Computes the list of placeables and their alignment for this translation unit.

    Declaration
    public Task<List<Placeable>> ComputePlaceablesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<Placeable>>

    A list of placeables

    ContainsQuickInsertId(SearchSettings, String)

    Returs true if the quickInsertId is supported/allowed for this tu

    Declaration
    public bool ContainsQuickInsertId(SearchSettings searchSettings, string quickInsertId)
    Parameters
    Type Name Description
    SearchSettings searchSettings
    System.String quickInsertId
    Returns
    Type Description
    System.Boolean

    DeleteTags()

    Deletes all tags from the TU's segments but keeps text placeholders (and locked content tags).

    Declaration
    public void DeleteTags()

    DeleteTags(Segment.DeleteTagsAction)

    Deletes all tags from the TU's segments and performs the specified Segment.DeleteTagsAction on text placeholders and locked content.

    Declaration
    public void DeleteTags(Segment.DeleteTagsAction action)
    Parameters
    Type Name Description
    Segment.DeleteTagsAction action

    Duplicate()

    Instantiates and returns a deep copy of the current instance.

    Declaration
    public TranslationUnit Duplicate()
    Returns
    Type Description
    TranslationUnit

    ExtractFragment(SegmentRange, SegmentRange)

    Extracts a fragment of a translation unit based on a segment range

    Declaration
    public TranslationUnit ExtractFragment(SegmentRange sourceRange, SegmentRange targetRange)
    Parameters
    Type Name Description
    SegmentRange sourceRange

    The segment range for the source segment

    SegmentRange targetRange

    The segment range for the target segment

    Returns
    Type Description
    TranslationUnit

    A translation unit containing the fragment specified by the segment range

    GenerateAlignmentData()

    If AlignmentData == null, creates minimal alignment data for the TU, based on placeable information

    Declaration
    [Obsolete("Use GenerateAlignmentDataAsync")]
    public bool GenerateAlignmentData()
    Returns
    Type Description
    System.Boolean

    True if alignment data was created, false otherwise (AlignmentData != null, or segment tokens not available)

    GenerateAlignmentDataAsync()

    If AlignmentData == null, creates minimal alignment data for the TU, based on placeable information

    Declaration
    public Task<bool> GenerateAlignmentDataAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    True if alignment data was created, false otherwise (AlignmentData != null, or segment tokens not available)

    GetMaxTagAnchor()

    Returns the highest tag anchor used in any segment, or 0 if no tags are present.

    Declaration
    public int GetMaxTagAnchor()
    Returns
    Type Description
    System.Int32

    GetQuickInsertIds(SearchSettings)

    Returns the supported/allowed list of quickInsertIds for this tu

    Declaration
    public IList<string> GetQuickInsertIds(SearchSettings searchSettings)
    Parameters
    Type Name Description
    SearchSettings searchSettings
    Returns
    Type Description
    System.Collections.Generic.IList<System.String>

    GetSystemFieldType(String)

    Returns the field value type for known system and pseudo fields.

    Declaration
    public static FieldValueType GetSystemFieldType(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName

    The field name.

    Returns
    Type Description
    FieldValueType

    The field type, or FieldValueType.Unknown if the field is not a known system or pseudo field.

    GetType(String)

    Retrieves the type of the specified field.

    Declaration
    public FieldValueType GetType(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName

    The field name.

    Returns
    Type Description
    FieldValueType

    The corresponding type or Unknown if a field with such name does not exist.

    GetValue(String)

    Retrieves the value of a specified field from this translation unit.

    The system fields can be retrieved using the following names:

    NameCorresponding System Field
    chdChange date
    chuChange user
    usdLast used date
    usuLast used user
    uscUsage counter
    crdCreation date
    cruCreation user

    Pseudo-fields contain values that are not saved as separate field values, but can be computed from the existing information in a translatin unit. The available pseudo-fields are:

    NameCorresponding Pseudo-field
    srcSource segment (including tags).
    trgTarget segment (including tags)
    sourceplainlengthThe length of the plain text in the source segment (without tags)
    targetplainlengthThe length of the plain text in the target segment (without tags)

    Declaration
    public FieldValue GetValue(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName

    The field name.

    Returns
    Type Description
    FieldValue

    The corresponding field value or null if such a field does not exist.

    GetValue(String, FieldValueType)

    Retrieves the field value with the specified type from this translation unit.

    Declaration
    public FieldValue GetValue(string fieldName, FieldValueType t)
    Parameters
    Type Name Description
    System.String fieldName

    The field name.

    FieldValueType t

    The field type.

    Returns
    Type Description
    FieldValue

    The corresponding field value, null if a field with the specified name does not exist or an error if the type does not match the result.

    IsStandardFieldName(String)

    Returns true if the name matches one of the built-in field names

    Declaration
    public static bool IsStandardFieldName(string name)
    Parameters
    Type Name Description
    System.String name
    Returns
    Type Description
    System.Boolean

    IsValid()

    Determines whether this instance is a valid translation unit.

    Declaration
    public bool IsValid()
    Returns
    Type Description
    System.Boolean

    SetValue(FieldValue, Boolean)

    Sets the value of the specified field, which can be a system field or a user field. Pseudo fields (such as src, trg, soruceplainlength, etc.) can not be set.

    Exceptions will be thrown if the field types are incompatible.

    Declaration
    public void SetValue(FieldValue fv, bool addIfMissing)
    Parameters
    Type Name Description
    FieldValue fv

    The new field value, including the field name.

    System.Boolean addIfMissing

    If true, a new field value is added to the current list of values if no previous value is present.

    Trim()

    Trims off peripheral whitespace from the TU's segments.

    Declaration
    public void Trim()

    Validate()

    Performs validation checks on this instance. All errors will be reported.

    Declaration
    public ErrorCode Validate()
    Returns
    Type Description
    ErrorCode

    An ErrorCode.

    Validate(Segment.ValidationMode)

    Performs validation checks on this instance with the specified validation mode.

    Declaration
    public ErrorCode Validate(Segment.ValidationMode mode)
    Parameters
    Type Name Description
    Segment.ValidationMode mode
    Returns
    Type Description
    ErrorCode

    An ErrorCode.

    Implements

    ITypedKeyValueContainer

    On this page

    • Constructors
      • TranslationUnit()
      • TranslationUnit(Segment, Segment)
      • TranslationUnit(TranslationUnit)
    • Properties
      • AlignmentData
      • AlignModelDate
      • ConfirmationLevel
      • Contexts
      • DocumentProperties
      • DocumentSegmentPair
      • FieldValues
      • FileId
      • FileProperties
      • Format
      • IdContexts
      • InsertDate
      • Origin
      • SourceSegment
      • StructureContexts
      • SystemFields
      • TargetSegment
    • Methods
      • CheckAndComputeTagAssociations()
      • CheckAndComputeTagAssociationsAndKeepInvalidAlignmentsAsync()
      • CheckAndComputeTagAssociationsAsync()
      • ComputePlaceables()
      • ComputePlaceablesAsync()
      • ContainsQuickInsertId(SearchSettings, String)
      • DeleteTags()
      • DeleteTags(Segment.DeleteTagsAction)
      • Duplicate()
      • ExtractFragment(SegmentRange, SegmentRange)
      • GenerateAlignmentData()
      • GenerateAlignmentDataAsync()
      • GetMaxTagAnchor()
      • GetQuickInsertIds(SearchSettings)
      • GetSystemFieldType(String)
      • GetType(String)
      • GetValue(String)
      • GetValue(String, FieldValueType)
      • IsStandardFieldName(String)
      • IsValid()
      • SetValue(FieldValue, Boolean)
      • Trim()
      • Validate()
      • Validate(Segment.ValidationMode)
    • Implements
    Back to top Generated by DocFX