Class ServerBasedTranslationMemoryLanguageDirection
Represents a language direction of a multilingual server-based translation memory (ServerBasedTranslationMemory).
Implements
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public class ServerBasedTranslationMemoryLanguageDirection : ISubsegmentTranslationMemoryLanguageDirection, ITranslationMemoryLanguageDirection, ITranslationProviderLanguageDirection
Constructors
ServerBasedTranslationMemoryLanguageDirection()
Creates a new, empty language direction.
Declaration
public ServerBasedTranslationMemoryLanguageDirection()
Remarks
In order to add a new language direction to a server-based translation memory, create a new ServerBasedTranslationMemoryLanguageDirection, set its SourceLanguage and TargetLanguage properties, then add it to the language directions of the translation memory (LanguageDirections) and save the translation memory (Save()).
Properties
CachedTranslationUnitCount
Gets the cached total translation unit count for this language direction. This count is computed at regular intervals and when performing imports. To calculate the actual translation unit count, use GetTranslationUnitCount() but bear in mind that this is a relatively expensive operation.
Declaration
public int CachedTranslationUnitCount { get; }
Property Value
Type | Description |
---|---|
int |
CanReverseLanguageDirection
Gets a flag which indicates whether the translation provider supports searches in the reversed language direction.
Declaration
public bool CanReverseLanguageDirection { get; }
Property Value
Type | Description |
---|---|
bool |
SourceLanguage
Gets or sets the source language.
Declaration
public CultureCode SourceLanguage { get; set; }
Property Value
Type | Description |
---|---|
CultureCode |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when trying to set the source language after the language direction has been created. |
SourceLanguageCode
Gets or sets the source language code.
Declaration
public string SourceLanguageCode { get; set; }
Property Value
Type | Description |
---|---|
string |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when trying to set the source language after the language direction has been created. |
TargetLanguage
Gets or sets the target language.
Declaration
public CultureCode TargetLanguage { get; set; }
Property Value
Type | Description |
---|---|
CultureCode |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when trying to set the target language after the language direction has been created. |
TargetLanguageCode
Gets or sets the target language code.
Declaration
public string TargetLanguageCode { get; set; }
Property Value
Type | Description |
---|---|
string |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when trying to set the target language after the language direction has been created. |
TranslationProvider
Gets the server-based translation memory to which this language direction belongs.
Declaration
public ServerBasedTranslationMemory TranslationProvider { get; }
Property Value
Type | Description |
---|---|
ServerBasedTranslationMemory |
Methods
AddOrUpdateTranslationUnits(TranslationUnit[], int[], ImportSettings)
Adds an array of translation units to the database. If hash codes of the previous translations are provided,
a found translation will be overwritten. If none is found, or the hash is 0 or the collection is null
,
the operation behaves identical to AddTranslationUnits(TranslationUnit[], ImportSettings).
If the provider doesn't support adding/updating, the implementation should return a reasonable ImportResult but should not throw an exception.
Declaration
public ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | An arrays of translation units to be added. |
int | previousTranslationHashes | If provided, a corresponding array of a the hash code of a previous translation. |
ImportSettings | settings | The settings used for this operation. |
Returns
Type | Description |
---|---|
ImportResult | An array of ImportResult objects, which mirrors the translation unit array. It has the exact same size and contains the status of each add operation for each particular translation unit with the same index within the array. |
AddOrUpdateTranslationUnitsMasked(TranslationUnit[], int[], ImportSettings, bool[])
Adds an array of translation units to the database, but will only add those for which the corresponding mask field is true. If the previous translation hashes are provided, existing translations will be updated if the target segment hash changed.
If the provider doesn't support adding/updating, the implementation should return a reasonable ImportResult but should not throw an exception.
Declaration
public ImportResult[] AddOrUpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | An arrays of translation units to be added. |
int | previousTranslationHashes | Corresponding hash codes of a previous translation (0 if unknown). The parameter may be null. |
ImportSettings | settings | The settings used for this operation. |
bool | mask | A boolean array with the same cardinality as the TU array, specifying which TUs to add. |
Returns
Type | Description |
---|---|
ImportResult | An array of ImportResult objects, which mirrors the translation unit array. It has the exact same size and contains the status of each add operation for each particular translation unit with the same index within the array. |
AddTranslationUnit(TranslationUnit, ImportSettings)
Adds a translation unit to the database. If the provider doesn't support adding/updating, the implementation should return a reasonable ImportResult but should not throw an exception.
Declaration
public ImportResult AddTranslationUnit(TranslationUnit translationUnit, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnit | The translation unit. |
ImportSettings | settings | The settings used for this operation. |
Returns
Type | Description |
---|---|
ImportResult | An ImportResult which represents the status of the operation (succeeded, ignored, etc). |
AddTranslationUnits(TranslationUnit[], ImportSettings)
Adds an array of translation units to the database. If the provider doesn't support adding/updating, the implementation should return a reasonable ImportResult but should not throw an exception.
Declaration
public ImportResult[] AddTranslationUnits(TranslationUnit[] translationUnits, ImportSettings settings)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | An arrays of translation units to be added. |
ImportSettings | settings | The settings used for this operation. |
Returns
Type | Description |
---|---|
ImportResult | An array of ImportResult objects, which mirrors the translation unit array. It has the exact same size and contains the status of each add operation for each particular translation unit with the same index within the array. |
AddTranslationUnitsMasked(TranslationUnit[], ImportSettings, bool[])
Adds an array of translation units to the database, but will only add those
for which the corresponding mask field is true
. If the provider doesn't support adding/updating, the
implementation should return a reasonable ImportResult but should not throw an exception.
Declaration
public ImportResult[] AddTranslationUnitsMasked(TranslationUnit[] translationUnits, ImportSettings settings, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | An arrays of translation units to be added. |
ImportSettings | settings | The settings used for this operation. |
bool | mask | A boolean array with the same cardinality as the TU array, specifying which TUs to add. |
Returns
Type | Description |
---|---|
ImportResult | An array of ImportResult objects, which mirrors the translation unit array. It has the exact same size and contains the status of each add operation for each particular translation unit with the same index within the array. |
ApplyFieldsToTranslationUnit(FieldValues, bool, PersistentObjectToken)
Applies the specified field values to the translation unit identified by the specified
translationUnitId
.
Declaration
public bool ApplyFieldsToTranslationUnit(FieldValues values, bool overwrite, PersistentObjectToken translationUnitId)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | values | The field values to apply |
bool | overwrite | If true, overwrite the old values, and merge the new values with the old ones otherwise. |
PersistentObjectToken | translationUnitId | The identifier of the translation unit to apply the field values to |
Returns
Type | Description |
---|---|
bool | true if the translation unit has been modified. false otherwise. |
ApplyFieldsToTranslationUnits(FieldValues, bool, PersistentObjectToken[])
Applies the specified field values to the translation units identified by the specified
translationUnitIds
collection.
Declaration
public int ApplyFieldsToTranslationUnits(FieldValues values, bool overwrite, PersistentObjectToken[] translationUnitIds)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | values | The field values to apply |
bool | overwrite | If true, overwrite the old values, and merge the new values with the old ones otherwise. |
PersistentObjectToken | translationUnitIds | A collection of translation unit IDs to apply the field values to |
Returns
Type | Description |
---|---|
int | The number of changed translation units |
DeleteAllTranslationUnits()
Deletes all translation units from the TM.
Declaration
public int DeleteAllTranslationUnits()
Returns
Type | Description |
---|---|
int | The number of deleted translation units |
DeleteTranslationUnit(PersistentObjectToken)
Deletes the translation unit with the specified translationUnitId
from the TM.
Declaration
public bool DeleteTranslationUnit(PersistentObjectToken translationUnitId)
Parameters
Type | Name | Description |
---|---|---|
PersistentObjectToken | translationUnitId | The ID of the translation unit to delete. |
Returns
Type | Description |
---|---|
bool | true if the translation unit was deleted, false otherwise. |
DeleteTranslationUnits(PersistentObjectToken[])
Deletes the translation units with the specified IDs from the translation memory.
Declaration
public int DeleteTranslationUnits(PersistentObjectToken[] translationUnitIds)
Parameters
Type | Name | Description |
---|---|---|
PersistentObjectToken | translationUnitIds | A collection of the translation unit IDs to delete |
Returns
Type | Description |
---|---|
int | The number of deleted translation units |
DeleteTranslationUnitsWithIterator(ref RegularIterator)
Deletes all translation units in the TM, using an iterator. The iterator will process only a fixed maximum number of translation units (MaxCount) and then the call will return, giving the client an opportunity to discontinue the process or update the UI before the next round-trip.
Optionally, a filter can be set on the iterator which then will only delete those TUs which satisfy the filter condition.
Declaration
public int DeleteTranslationUnitsWithIterator(ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
RegularIterator | iterator | The iterator to use. |
Returns
Type | Description |
---|---|
int | The number of deleted translation units. |
EditTranslationUnits(EditScript, EditUpdateMode, PersistentObjectToken[])
Applies an EditScript to the translation units identified by the
identifiers in the translationUnitIds
collection.
Declaration
public int EditTranslationUnits(EditScript editScript, EditUpdateMode updateMode, PersistentObjectToken[] translationUnitIds)
Parameters
Type | Name | Description |
---|---|---|
EditScript | editScript | The edit script to apply |
EditUpdateMode | updateMode | The update mode, which can be to update changed translation units in-place or add new translation units to the TM (which is only relevant if segment data has been changed). |
PersistentObjectToken | translationUnitIds | The collection of TU IDs to apply the edit script to. |
Returns
Type | Description |
---|---|
int | The number of changed or edited translation units |
EditTranslationUnitsWithIterator(EditScript, EditUpdateMode, ref RegularIterator)
Applies an EditScript to the translation units, using an iterator.
Declaration
public int EditTranslationUnitsWithIterator(EditScript editScript, EditUpdateMode updateMode, ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
EditScript | editScript | The edit script to apply |
EditUpdateMode | updateMode | The update mode, which can be to update changed translation units in-place or add new translation units to the TM (which is only relevant if segment data has been changed). |
RegularIterator | iterator | The iterator to use. Note that a filter condition can be set on the iterator in which case the script will only be applied to those translation units which satisfy the filter condition. |
Returns
Type | Description |
---|---|
int | The number of changed or edited translation units |
Remarks
Note that a filter condition can also be set on the editScript
instead of the iterator. Depending on the back-end storage, it may be more efficient to
set it on the iterator than on the edit script.
GetDuplicateTranslationUnits(ref DuplicateIterator)
Returns a set of potentially duplicated translation units in the TM, using a special DuplicateIterator. A group of TUs are considered potential duplicates of each other if the internal hash values for their source segments are identical. There may be several reasons for this being the case:
- The TUs have the same source segment, but different translations
- The TUs have different source segments, but only differ in complex tokens (controlled through the TM's ITranslationMemory.Recognizers) which will result in the identical hash values,
- The source segments only differ by whitespace or certain punctuation, which do not modify the hash values,
- The hashing algorithm leads to collisions in which case the segments may be entirely different, but still result in the same hash value.
Declaration
public TranslationUnit[] GetDuplicateTranslationUnits(ref DuplicateIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
DuplicateIterator | iterator | The iterator to use |
Returns
Type | Description |
---|---|
TranslationUnit | The translation units which are potential duplicates, or null if no more potential duplicates can be found. |
GetTranslationUnit(PersistentObjectToken)
Retrieves the translation unit with the specified translationUnitId
from the
translation memory.
Declaration
public TranslationUnit GetTranslationUnit(PersistentObjectToken translationUnitId)
Parameters
Type | Name | Description |
---|---|---|
PersistentObjectToken | translationUnitId | The ID of the translation unit to retrieve. |
Returns
Type | Description |
---|---|
TranslationUnit | The translation unit with the specified ID, or null if that TU does not exist. |
GetTranslationUnitCount()
Returns the number of translation units in this TM.
Declaration
public int GetTranslationUnitCount()
Returns
Type | Description |
---|---|
int |
GetTranslationUnits(ref RegularIterator)
Retrieves a set of translation units, using an iterator. At most
MaxCount translation units will be returned in one
round-trip.
Declaration
public TranslationUnit[] GetTranslationUnits(ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
RegularIterator | iterator | The iterator |
Returns
Type | Description |
---|---|
TranslationUnit | The translation units, or null if no more translation units can be retrieved. |
GetTranslationUnitsWithContextContent(ref RegularIterator)
Identical to GetTranslationUnits(ref RegularIterator) except that the implementation will attempt to populate the Segment1 and Segment2 properties for any items in the Contexts collection of a tu
Declaration
public TranslationUnit[] GetTranslationUnitsWithContextContent(ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
RegularIterator | iterator |
Returns
Type | Description |
---|---|
TranslationUnit |
Remarks
Implementations must ensure Segment1 and Segment2 are tokenized and that their Tokens collections are returned to the client.
Import(ImportSettings, string)
Use server tm import feature to import TM
Declaration
public ImportEntity Import(ImportSettings settings, string fileName)
Parameters
Type | Name | Description |
---|---|---|
ImportSettings | settings | |
string | fileName |
Returns
Type | Description |
---|---|
Sdl.Desktop.Platform.ServerConnectionPlugin.Entities.ImportEntity |
PreviewEditTranslationUnitsWithIterator(EditScript, ref RegularIterator)
Applies the specified edit script to the translation units in a TM, but unlike EditTranslationUnitsWithIterator(EditScript, EditUpdateMode, ref RegularIterator), the TUs will not be updated in the TM, but modified copies of the TUs will be returned to the caller. This can be used to "preview" the changes the edit script would apply.
Declaration
public TranslationUnit[] PreviewEditTranslationUnitsWithIterator(EditScript editScript, ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
EditScript | editScript | The edit script |
RegularIterator | iterator | An iterator. See also the iterator-related remarks for EditTranslationUnitsWithIterator(EditScript, EditUpdateMode, ref RegularIterator). |
Returns
Type | Description |
---|---|
TranslationUnit |
ReindexTranslationUnits(ref RegularIterator)
Re-indexes the translation memory, using an iterator so that the client can update progress indicators or discontinue the process.
The same iterator instance should be passed in subsequent calls, in order to obtain the next page, and so on.
Declaration
public bool ReindexTranslationUnits(ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
RegularIterator | iterator | The iterator to use for the re-indexing process. |
Returns
Type | Description |
---|---|
bool | False if the iterator is at the end of the TM or the TM is empty, true otherwise. The re-indexing process should be continued until the method returns false. |
Remarks
For larger TMs (> 100.000 TUs) it is recommended to also recompute the index statistics after the re-indexing finished (see RecomputeFuzzyIndexStatistics()).
SearchSegment(SearchSettings, Segment)
Performs a segment search.
Declaration
public SearchResults SearchSegment(SearchSettings settings, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
Segment | segment | The segment to search for. |
Returns
Type | Description |
---|---|
SearchResults | A SearchResults object containing the results or an empty object if no results were found. |
SearchSegment(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment)
Performs a segment-level search, and optionally a subsegment search
Declaration
public SegmentAndSubsegmentSearchResults SearchSegment(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the segment-level search parameters. |
SubsegmentSearchSettings | subsegmentSettings | The settings that define the subsegment search parameters, or null if a subsegment search should not be performed. |
SubsegmentSearchCondition | condition | If |
Segment | segment | The segment to search for. |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults | A SearchResults object containing the results or an empty object if no results were found. |
SearchSegments(SearchSettings, Segment[])
Performs a search for an array of segments.
Declaration
public SearchResults[] SearchSegments(SearchSettings settings, Segment[] segments)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
Segment | segments | The array containing the segments to search for. |
Returns
Type | Description |
---|---|
SearchResults | An array of SearchResults objects, which mirrors the segments array. It has the exact same size and contains the search results for each segment with the same index within the segments array. |
SearchSegments(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[])
Performs a segment-level search, and optionally a subsegment search, for an array of segments.
Declaration
public SegmentAndSubsegmentSearchResults[] SearchSegments(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment[] segments)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the segment-level search parameters. |
SubsegmentSearchSettings | subsegmentSettings | The settings that define the subsegment search parameters, or null if a subsegment search should not be performed. |
SubsegmentSearchCondition | condition | If |
Segment | segments | The array containing the segments to search for. |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults | An array of SearchResults objects, which mirrors the segments array. It has the exact same size and contains the search results for each segment with the same index within the segments array. |
SearchSegmentsMasked(SearchSettings, Segment[], bool[])
Performs a search for an array of segments, specifying a mask which specifies which segments should actually be
searched (only those for which the corresponding mask bit is true
are searched). If the mask is null
, the method
behaves identically to SearchSegments(SearchSettings, Segment[]). Passing a mask only makes sense in document search contexts (IsDocumentSearch
set to true
).
Declaration
public SearchResults[] SearchSegmentsMasked(SearchSettings settings, Segment[] segments, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
Segment | segments | The array containing the segments to search for. |
bool | mask | The array containing the segments to search for. |
Returns
Type | Description |
---|---|
SearchResults | An array of SearchResults objects, which mirrors the segments array. It has the exact same size and contains the search results for each segment with the same index within the segments array. |
SearchSegmentsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, Segment[], bool[])
Performs a segment-level search, and optionally a subsegment search, for an array of segments, specifying a mask which specifies which segments should actually be
searched (only those for which the corresponding mask bit is true
are searched). If the mask is null
, the method
behaves identically to SearchSegments(SearchSettings, Segment[]). Passing a mask only makes sense in document search contexts (IsDocumentSearch
set to true
).
Declaration
public SegmentAndSubsegmentSearchResults[] SearchSegmentsMasked(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, Segment[] segments, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the segment-level search parameters. |
SubsegmentSearchSettings | subsegmentSettings | The settings that define the subsegment search parameters, or null if a subsegment search should not be performed. |
SubsegmentSearchCondition | condition | If |
Segment | segments | The array containing the segments to search for. |
bool | mask | The array containing the segments to search for. |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults | An array of SearchResults objects, which mirrors the segments array. It has the exact same size and contains the search results for each segment with the same index within the segments array. |
SearchText(SearchSettings, string)
Performs a text search.
Declaration
public SearchResults SearchText(SearchSettings settings, string segment)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
string | segment | The text to search for. |
Returns
Type | Description |
---|---|
SearchResults | A SearchResults object containing the results or an empty object if no results were found. |
SearchTranslationUnit(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit)
Performs a translation unit search, and optionally a subsegment search on the source segment
Declaration
public SegmentAndSubsegmentSearchResults SearchTranslationUnit(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit translationUnit)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the segment-level search parameters. |
SubsegmentSearchSettings | subsegmentSettings | The settings that define the subsegment search parameters, or null if a subsegment search should not be performed. |
SubsegmentSearchCondition | condition | If |
TranslationUnit | translationUnit | The translation unit to search for. |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults | An object containing the results or an empty object if no results were found. |
SearchTranslationUnit(SearchSettings, TranslationUnit)
Performs a translation unit search.
Declaration
public SearchResults SearchTranslationUnit(SearchSettings settings, TranslationUnit translationUnit)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
TranslationUnit | translationUnit | The translation unit to search for. |
Returns
Type | Description |
---|---|
SearchResults | A SearchResults object containing the results or an empty object if no results were found. |
SearchTranslationUnits(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[])
Performs a translation unit search, and optionally a subsegment search on the source segment, for an array of translation units.
Declaration
public SegmentAndSubsegmentSearchResults[] SearchTranslationUnits(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit[] translationUnits)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the segment-level search parameters. |
SubsegmentSearchSettings | subsegmentSettings | The settings that define the subsegment search parameters, or null if a subsegment search should not be performed. |
SubsegmentSearchCondition | condition | If |
TranslationUnit | translationUnits | The array containing the translation units to search for. |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults | An array of objects, which mirrors the translation unit array. It has the exact same size and contains the search results for each translation unit with the same index within the translation unit array. |
SearchTranslationUnits(SearchSettings, TranslationUnit[])
Performs a translation unit search for an array of translation units.
Declaration
public SearchResults[] SearchTranslationUnits(SearchSettings settings, TranslationUnit[] translationUnits)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
TranslationUnit | translationUnits | The array containing the translation units to search for. |
Returns
Type | Description |
---|---|
SearchResults | An array of SearchResults objects, which mirrors the translation unit array. It has the exact same size and contains the search results for each translation unit with the same index within the translation unit array. |
SearchTranslationUnitsMasked(SearchSettings, SubsegmentSearchSettings, SubsegmentSearchCondition, TranslationUnit[], bool[])
Similar to SearchTranslationUnits(SearchSettings, TranslationUnit[]), but allows passing a mask which specifies which TUs are actually searched. This is useful in document search contexts where some TUs are passed which should be used to establish a (text) context, but which should not be processed.
Declaration
public SegmentAndSubsegmentSearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, SubsegmentSearchSettings subsegmentSettings, SubsegmentSearchCondition condition, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the segment-level search parameters. |
SubsegmentSearchSettings | subsegmentSettings | The settings that define the subsegment search parameters, or null if a subsegment search should not be performed. |
SubsegmentSearchCondition | condition | If |
TranslationUnit | translationUnits | The array containing the translation units to search for. |
bool | mask | A |
Returns
Type | Description |
---|---|
SegmentAndSubsegmentSearchResults | An array of objects, which mirrors the translation unit array. It has the exact same size and contains the search results for each translation unit with the same index within the translation unit array. |
SearchTranslationUnitsMasked(SearchSettings, TranslationUnit[], bool[])
Similar to SearchTranslationUnits(SearchSettings, TranslationUnit[]), but allows passing a mask which specifies which TUs are actually searched. This is useful in document search contexts where some TUs are passed which should be used to establish a (text) context, but which should not be processed.
Declaration
public SearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
SearchSettings | settings | The settings that define the search parameters. |
TranslationUnit | translationUnits | The array containing the translation units to search for. |
bool | mask | A |
Returns
Type | Description |
---|---|
SearchResults | An array of SearchResults objects, which mirrors the translation unit array. It has the exact same size and contains the search results for each translation unit with the same index within the translation unit array. |
SubsegmentSearchSegment(SubsegmentSearchSettings, Segment)
Searches the TM for subsegment matches for a given segment
Declaration
public SubsegmentSearchResultsCollection SubsegmentSearchSegment(SubsegmentSearchSettings settings, Segment segment)
Parameters
Type | Name | Description |
---|---|---|
SubsegmentSearchSettings | settings | The settings that define the search parameters. |
Segment | segment | The segment for which subsegment matches should be sought, aka 'query segment' |
Returns
Type | Description |
---|---|
SubsegmentSearchResultsCollection | A SubsegmentSearchResultsCollection object containing any subsegment matches found. |
Remarks
See SubsegmentSearchSettings remarks for further information.
SubsegmentSearchSegments(SubsegmentSearchSettings, Segment[])
Searches the TM for subsegment matches for an array of segments.
Declaration
public SubsegmentSearchResultsCollection[] SubsegmentSearchSegments(SubsegmentSearchSettings settings, Segment[] segments)
Parameters
Type | Name | Description |
---|---|---|
SubsegmentSearchSettings | settings | The settings that define the search parameters. |
Segment | segments | The array containing the segments for which subsegment matches should be sought |
Returns
Type | Description |
---|---|
SubsegmentSearchResultsCollection | A SubsegmentSearchResultsCollection object containing any subsegment matches found. |
Remarks
See SubsegmentSearchSettings remarks for further information.
SupportedSubsegmentMatchTypes()
Reports the subsegment match types supported by this TM.
Declaration
public List<SubsegmentMatchType> SupportedSubsegmentMatchTypes()
Returns
Type | Description |
---|---|
ListSubsegmentMatchType |
UpdateCachedTranslationUnitCount()
Updates the cached translation unit count. Normally, the translation unit count is updated automatically every night. Only use this method to ensure the translation unit count reported by CachedTranslationUnitCount after adding a large amount of translation units. There is no need to call this method after an import using a TranslationMemoryImporter or a ScheduledServerTranslationMemoryImport; these classes automatically update the cached translation unit count.
Declaration
public void UpdateCachedTranslationUnitCount()
UpdateTranslationUnit(TranslationUnit)
Updates the properties and fields of an existing translation unit if the source and target segments are unchanged or adds a new translation unit otherwise. If the provider doesn't support adding/updating, the implementation should return a reasonable ImportResult but should not throw an exception.
The translation unit should be initialized in a previous call to the translation memory, so that the ID property is set to a valid value.
Declaration
public ImportResult UpdateTranslationUnit(TranslationUnit translationUnit)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnit | The translation unit to be updated. |
Returns
Type | Description |
---|---|
ImportResult | The result of the operation. |
UpdateTranslationUnits(TranslationUnit[])
Updates the properties and fields of an array of existing translation units if the source and target segments are unchanged or adds new translation units otherwise. If the provider doesn't support adding/updating, the implementation should return a reasonable ImportResult but should not throw an exception.
The translation units should be initialized in previous calls to the translation memory, so that their ID properties are set to valid values.
Declaration
public ImportResult[] UpdateTranslationUnits(TranslationUnit[] translationUnits)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | The translation unit array to be updated. |
Returns
Type | Description |
---|---|
ImportResult | An array of results which mirrors the translation unit array. It has the exact same size and contains the results for each translation unit with the same index within the translation unit array. |
UpdateTranslationUnitsMasked(TranslationUnit[], bool[])
Updates (adds, overwrites, or merges) the specified translation units.
Declaration
public ImportResult[] UpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | translationUnits | The translation units to update. |
bool | mask | An optional mask with the same length as . Those TUs for which the corresponding
flag is will only be used to establish context information. If no masking
is required, this parameter can be null.
|
Returns
Type | Description |
---|---|
ImportResult | An array of ImportResults with the same length as |