Module crowdin_api.api_resources.translation_memory.resource

Classes

class TranslationMemoryResource (requester: APIRequester, project_id: Optional[int] = None, page_size=25)

Resource for Translation Memory.

Translation Memory (TM) is a vault of translations that were previously made in other projects. Those translations can be reused to speed up the translation process. Every translation made in the project is automatically added to the project Translation Memory.

Use API to create, upload, download, or remove specific TM. Translation Memory export and import are asynchronous operations and shall be completed with sequence of API methods.

Link to documentation: https://support.crowdin.com/developer/api/v2/#tag/Translation-Memory

Ancestors

Methods

def add_tm(self, name: str, languageId: str, isShared: Optional[bool] = None, groupId: Optional[int] = None)

Add TM.

:param isShared: Whether the TM should be shared to all projects within the account (Crowdin) or within the group (Crowdin Enterprise). :param groupId: Group Identifier. If 0 – the TM will be available for all projects and groups in the workspace. Crowdin Enterprise only.

Link to documentation: https://support.crowdin.com/developer/api/v2/#operation/api.tms.post

def check_tm_export_status(self, tmId: int, exportId: str)
def check_tm_import_status(self, tmId: int, importId: str)
def clear_tm(self, tmId: int)
def concordance_search_in_tms(self, sourceLanguageId: str, targetLanguageId: str, autoSubstitution: bool, minRelevant: int, expressions: Iterable[str], projectId: Optional[int] = None)
def create_tm_segment(self, tmId: int, records: Iterable[TranslationMemorySegmentRecord])
def delete_tm(self, tmId: int)
def delete_tm_segment(self, tmId: int, segmentId: int)
def download_tm(self, tmId: int, exportId: str)
def edit_tm(self, tmId: int, data: Iterable[TranslationMemoryPatchRequest])

Edit TM.

TranslationMemoryPatchPath.GROUP_ID (/groupId) is Crowdin Enterprise only.

Link to documentation: https://support.crowdin.com/developer/api/v2/#operation/api.tms.patch

def edit_tm_segment(self, tmId: int, segmentId: int, data: Iterable[Union[TranslationMemorySegmentRecordOperationAdd, TranslationMemorySegmentRecordOperationReplace, TranslationMemorySegmentRecordOperationRemove]])
def export_tm(self, tmId: int, sourceLanguageId: Optional[str] = None, targetLanguageId: Optional[str] = None, format: Union[TranslationMemoryExportFormat, ExportFormat, None] = None)

Export TM.

:param format: TM file format: tmx (default), csv or xlsx. Use TranslationMemoryExportFormat.

Link to documentation: https://support.crowdin.com/developer/api/v2/#operation/api.tms.exports.post

def get_tm(self, tmId: int)
def get_tm_export_path(self, tmId: int, exportId: Optional[str] = None)
def get_tm_segment(self, tmId: int, segmentId: int)
def get_tm_segments_path(self, tmId: int, segmentId: Optional[int] = None)
def get_tms_path(self, tmId: Optional[int] = None)
def import_tm(self, tmId: int, storageId: int, scheme: Optional[Dict[~KT, ~VT]] = None, firstLineContainsHeader: Optional[bool] = None)
def list_tm_segments(self, tmId: int, orderBy: Optional[Sorting] = None, page: Optional[int] = None, offset: Optional[int] = None, limit: Optional[int] = None, croql: Optional[str] = None)

List TM Segments.

:param croql: Filter segments by CroQL.

Link to documentation: https://support.crowdin.com/developer/api/v2/#operation/api.tms.segments.getMany

def list_tms(self, orderBy: Optional[Sorting] = None, page: Optional[int] = None, offset: Optional[int] = None, limit: Optional[int] = None, filter: Optional[str] = None, userId: Optional[int] = None, groupId: Optional[int] = None)

List TMs.

:param filter: Filter TMs by name. :param userId: Project Member Identifier. Crowdin only. :param groupId: Group Identifier. Set 0 to see TMs of root group. Crowdin Enterprise only.

Link to documentation: https://support.crowdin.com/developer/api/v2/#operation/api.tms.getMany

def tm_segment_batch_operations(self, tmId: int, data: Iterable[Union[TranslationMemorySegmentBatchOperationAdd, TranslationMemorySegmentBatchOperationReplace, TranslationMemorySegmentBatchOperationRemove]])