Interface ITranslationMemoryLanguageDirection
Exposes functionality for a specific language direction within a translation memory.
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public interface ITranslationMemoryLanguageDirection : ITranslationProviderLanguageDirection
Properties
TranslationProvider
Gets the translation memory to which this language direction belongs.
Declaration
ITranslationMemory TranslationProvider { get; }
Property Value
Type | Description |
---|---|
ITranslationMemory |
Methods
ApplyFieldsToTranslationUnit(FieldValues, Boolean, PersistentObjectToken)
Applies the specified field values to the translation unit identified by the specified
translationUnitId
.
Declaration
bool ApplyFieldsToTranslationUnit(FieldValues values, bool overwrite, PersistentObjectToken translationUnitId)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | values | The field values to apply |
System.Boolean | 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 |
---|---|
System.Boolean | true if the translation unit has been modified. false otherwise. |
ApplyFieldsToTranslationUnits(FieldValues, Boolean, PersistentObjectToken[])
Applies the specified field values to the translation units identified by the specified
translationUnitIds
collection.
Declaration
int ApplyFieldsToTranslationUnits(FieldValues values, bool overwrite, PersistentObjectToken[] translationUnitIds)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | values | The field values to apply |
System.Boolean | 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 |
---|---|
System.Int32 | The number of changed translation units |
DeleteAllTranslationUnits()
Deletes all translation units from the TM.
Declaration
int DeleteAllTranslationUnits()
Returns
Type | Description |
---|---|
System.Int32 | The number of deleted translation units |
DeleteTranslationUnit(PersistentObjectToken)
Deletes the translation unit with the specified translationUnitId
from the TM.
Declaration
bool DeleteTranslationUnit(PersistentObjectToken translationUnitId)
Parameters
Type | Name | Description |
---|---|---|
PersistentObjectToken | translationUnitId | The ID of the translation unit to delete. |
Returns
Type | Description |
---|---|
System.Boolean | true if the translation unit was deleted, false otherwise. |
DeleteTranslationUnits(PersistentObjectToken[])
Deletes the translation units with the specified IDs from the translation memory.
Declaration
int DeleteTranslationUnits(PersistentObjectToken[] translationUnitIds)
Parameters
Type | Name | Description |
---|---|---|
PersistentObjectToken[] | translationUnitIds | A collection of the translation unit IDs to delete |
Returns
Type | Description |
---|---|
System.Int32 | 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
int DeleteTranslationUnitsWithIterator(ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
RegularIterator | iterator | The iterator to use. |
Returns
Type | Description |
---|---|
System.Int32 | 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
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 |
---|---|
System.Int32 | The number of changed or edited translation units |
EditTranslationUnitsWithIterator(EditScript, EditUpdateMode, ref RegularIterator)
Applies an EditScript to the translation units, using an iterator.
Declaration
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 |
---|---|
System.Int32 | 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
) 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
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
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. Note that the computation of the TU count may be a time-consuming operation for some back-end storage systems.
Declaration
int GetTranslationUnitCount()
Returns
Type | Description |
---|---|
System.Int32 |
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
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. |
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
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
bool ReindexTranslationUnits(ref RegularIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
RegularIterator | iterator | The iterator to use for the re-indexing process. |
Returns
Type | Description |
---|---|
System.Boolean | 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()).
UpdateTranslationUnitsMasked(TranslationUnit[], Boolean[])
Updates (adds, overwrites, or merges) the specified translation units.
Declaration
ImportResult[] UpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, bool[] mask)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit[] | translationUnits | The translation units to update. |
System.Boolean[] | 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 |